<?php 
/**
 * Register/enqueue custom scripts and styles
 */
add_action( 'wp_enqueue_scripts', function() {
	// Enqueue your files on the canvas & frontend, not the builder panel. Otherwise custom CSS might affect builder)
	if ( ! bricks_is_builder_main() ) {
		wp_enqueue_style( 'bricks-child', get_stylesheet_uri(), ['bricks-frontend'], filemtime( get_stylesheet_directory() . '/style.css' ) );
	}
} );

/**
 * Register custom elements
 */
add_action( 'init', function() {
  $element_files = [
    __DIR__ . '/elements/title.php',
  ];

  foreach ( $element_files as $file ) {
    \Bricks\Elements::register_element( $file );
  }
}, 11 );

/**
 * Add text strings to builder
 */
add_filter( 'bricks/builder/i18n', function( $i18n ) {
  // For element category 'custom'
  $i18n['custom'] = esc_html__( 'Custom', 'bricks' );

  return $i18n;
} );

/**
 * Allow HTML tags to builder
 */
add_filter( 'bricks/allowed_html_tags', function( $allowed_html_tags ) {
// Define the additional tags to be added (e.g. 'form' & 'select')
$additional_tags = ['svg', 'defs', 'path', 'text', 'textPath', 'img-comparison-slider', 'bar', 'time', 'li', 'ul'];

// Merge additional tags with the existing allowed tags
return array_merge( $allowed_html_tags, $additional_tags );
} );
