diff --git a/assets/js/blocks/general.js b/assets/js/blocks/general.js index b768075c..3bdd34b2 100644 --- a/assets/js/blocks/general.js +++ b/assets/js/blocks/general.js @@ -139,9 +139,9 @@ wp.domReady(() => { }, [ ['core/image', { - width: 20, + width: '20px', sizeSlug: 'large', - url: 'http://localhost:8883/wp-content/themes/lsx-tour-operator/assets/images/Typetype-icon.png', + url: 'https://tour-operator.lsx.design/wp-content/uploads/2024/06/image-1.png', alt: '' }], ['core/paragraph', { @@ -244,9 +244,9 @@ wp.domReady(() => { }, [ ['core/image', { - width: 20, + width: '20px', sizeSlug: 'large', - url: 'http://localhost:8883/wp-content/themes/lsx-tour-operator/assets/images/best-months-to-travel-TO-icon-black-20px-1-1.png', + url: lsxToEditor.homeUrl + 'wp-content/uploads/2024/11/booking-validity-icon-black-52px-1.svg', alt: '' }], ['core/paragraph', { diff --git a/includes/classes/blocks/class-registration.php b/includes/classes/blocks/class-registration.php index da0838ec..774de6d3 100644 --- a/includes/classes/blocks/class-registration.php +++ b/includes/classes/blocks/class-registration.php @@ -36,17 +36,16 @@ public function __construct() { public function enqueue_block_variations_script() { $scripts = [ - 'general' => '', - 'tour' => '', - 'accommodation' => '', - 'destination' => '', - 'query-loops' => '', + 'general' => array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ), + 'tour' => array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post', 'lsx-to-block-general-variations' ), + 'accommodation' => array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post', 'lsx-to-block-general-variations' ), + 'destination' => array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post', 'lsx-to-block-general-variations' ), + 'query-loops' => array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post', 'lsx-to-block-general-variations' ), ]; $additional_scripts = [ 'linked-cover' => array( 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-hooks' ), 'slider-query' => array( 'wp-blocks', 'wp-element', 'wp-editor', 'wp-components', 'wp-compose' ), - 'onsale-query' => array( 'wp-blocks', 'wp-element', 'wp-editor', 'wp-components', 'wp-compose' ), ]; // Make sure the script is only enqueued in the block editor. @@ -60,6 +59,14 @@ public function enqueue_block_variations_script() { filemtime( LSX_TO_PATH . 'assets/js/blocks/' . $slug . '.js' ), // Versioning with file modification time. true // Enqueue in the footer. ); + if ( 'general' === $slug ) { + $param_array = array( + 'homeUrl' => trailingslashit( home_url() ), + 'assetsUrl' => LSX_TO_URL . 'assets/img/' + ); + $param_array = apply_filters( 'lsx_to_editor_params', $param_array ); + wp_localize_script( 'lsx-to-block-' . $slug . '-variations', 'lsxToEditor', $param_array ); + } } foreach ( $additional_scripts as $slug => $dependancies ) { @@ -367,17 +374,17 @@ public function maybe_hide_varitaion( $block_content, $parsed_block, $block_obj } /** - * Determines if a post exists based on the ID. - * - * - * @global wpdb $wpdb WordPress database abstraction object. - * - * @param string $title Post title. - * @param string $content Optional. Post content. - * @param string $date Optional. Post date. - * @param string $type Optional. Post type. - * @param string $status Optional. Post status. - * @return int Post ID if post exists, 0 otherwise. + * Determines if a post exists based on the ID. + * + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $title Post title. + * @param string $content Optional. Post content. + * @param string $date Optional. Post date. + * @param string $type Optional. Post type. + * @param string $status Optional. Post status. + * @return int Post ID if post exists, 0 otherwise. */ protected function post_ids_exist( $ids ) { global $wpdb;