editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode() ) { $scripts[] = 'gridmaster-builder-preview'; } return $scripts; } /** * Style dependencies. */ public function get_style_depends() { $styles = array( 'gridmaster-frontend-v2' ); if ( \Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode() ) { $styles[] = 'gridmaster-builder-preview'; } return $styles; } /** * Register widget controls. */ protected function register_controls() { $this->start_controls_section( 'section_grid_settings', array( 'label' => __( 'Grid Settings', 'ajax-filter-posts' ), 'tab' => Controls_Manager::TAB_CONTENT, ) ); $choices = Embed_Helper::get_grid_choices(); $this->add_control( 'grid_id', array( 'label' => __( 'Select Grid', 'ajax-filter-posts' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'default' => '0', 'options' => $choices, 'description' => __( 'Choose a saved GridMaster layout to display.', 'ajax-filter-posts' ), ) ); if ( current_user_can( 'manage_options' ) ) { $this->add_control( 'edit_grid_button', array( 'type' => Controls_Manager::BUTTON, 'text' => __( 'Edit Selected Grid ↗', 'ajax-filter-posts' ), 'event' => 'gridmaster:edit_grid', 'button_type' => 'default', 'condition' => array( 'grid_id!' => array( '0', 0, '' ), ), ) ); $create_url = Embed_Helper::get_create_url(); $manage_url = Embed_Helper::get_manage_url(); $links_html = '
'; if ( $create_url ) { $links_html .= sprintf( '+ %s
', esc_url( $create_url ), esc_html__( 'Create New Grid in GridMaster', 'ajax-filter-posts' ) ); } if ( $manage_url ) { $links_html .= sprintf( '%s', esc_url( $manage_url ), esc_html__( 'Manage All Grids', 'ajax-filter-posts' ) ); } $links_html .= '
'; $this->add_control( 'grid_manager_links', array( 'type' => Controls_Manager::RAW_HTML, 'raw' => $links_html, ) ); } $this->end_controls_section(); } /** * Render widget output on frontend / canvas. */ protected function render() { $settings = $this->get_settings_for_display(); $grid_id = ! empty( $settings['grid_id'] ) ? absint( $settings['grid_id'] ) : 0; echo Embed_Helper::render( $grid_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } }