manager = $manager; } /** * Registers the original implementation together with the custom additions. * * @since 1.0.0 */ public function register() { remove_action( 'customize_controls_print_footer_scripts', [ $this->manager->nav_menus, 'available_items_template' ] ); add_action( 'customize_controls_print_footer_scripts', [ $this, 'available_items_template' ] ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); } /** * Enqueues scripts and styles for Customizer pane. * * @since 1.0.0 */ public function enqueue_scripts() { wp_enqueue_script( 'aleno-customize' ); wp_enqueue_style( 'aleno-customize' ); wp_localize_script( 'aleno-customize', 'alenoSettings', [ 'data' => [ 'url' => esc_url( __( 'https://www.aleno.me', 'aleno-restaurant-reservations' ) ), ], 'l10n' => [ 'label' => __( 'Booking Link', 'aleno-restaurant-reservations' ), ], ] ); } /** * Prints the html template used to render the add-menu-item frame. * * @since 1.0.0 */ public function available_items_template() { ob_start(); $this->manager->nav_menus->available_items_template(); $template = ob_get_clean(); echo str_replace( '', $this->get_booking_links_available_menu_item() . '', $template ); } /** * Returns the markup for aleno booking links. * * @since 1.0.0 * * @return string HTML markup. */ protected function get_booking_links_available_menu_item() { ob_start(); ?>