array( 'name' => esc_html__( 'Tabs', 'mega' ), 'description' => esc_html__( 'Tabs Block', 'mega' )), 'universal' => true, 'pro' => true, 'true-wrapper' => false, 'class_base' => 'ys-tabs' ); add_filter( 'mega_form_select_lists', array( $this, 'addList' )); add_filter( 'mega_tabs_widget_list', array( $this, 'doList' )); parent::__construct( __CLASS__, $args ); } public function settings( $form ) { $form->add_control( 'Mega_Control_onOff', array( 'label' => esc_html__( 'Tab 1', 'mega' ), 'value' => 1, 'name' => 'tab_1' )); $form->add_sub_control( 'Mega_Control_Text', array( 'control' => 'tab_1', 'control_value' => 'true', 'label' => esc_html__( 'Title', 'mega' ), 'value' => esc_html__( 'Comments', 'mega' ), 'name' => 'title_1' )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'tab_1', 'control_value' => 'true', 'label' => esc_html__( 'Widget', 'mega' ), 'pro' => 1, 'value' => 'Mega_Block_Comments', 'name' => 'widget_1', 'use_list' => 1, 'list' => 'mega_tabs_widget_list' )); $form->add_control( 'Mega_Control_onOff', array( 'label' => esc_html__( 'Tab 2', 'mega' ), 'value' => 1, 'name' => 'tab_2' )); $form->add_sub_control( 'Mega_Control_Text', array( 'control' => 'tab_2', 'control_value' => 'true', 'label' => esc_html__( 'Title', 'mega' ), 'value' => esc_html__( 'Posts', 'mega' ), 'name' => 'title_2' )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'tab_2', 'control_value' => 'true', 'label' => esc_html__( 'Widget', 'mega' ), 'pro' => 1, 'value' => 'Mega_Block_Posts', 'name' => 'widget_2', 'use_list' => 1, 'list' => 'mega_tabs_widget_list' )); $form->add_control( 'Mega_Control_onOff', array( 'label' => esc_html__( 'Tab 3', 'mega' ), 'pro' => 1, 'value' => 0, 'name' => 'tab_3' )); $form->add_sub_control( 'Mega_Control_Text', array( 'control' => 'tab_3', 'control_value' => 'true', 'label' => esc_html__( 'Title', 'mega' ), 'value' => '', 'name' => 'title_3' )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'tab_3', 'control_value' => 'true', 'label' => esc_html__( 'Widget', 'mega' ), 'pro' => 1, 'value' => '', 'name' => 'widget_3', 'use_list' => 1, 'list' => 'mega_tabs_widget_list' )); $form->add_control( 'Mega_Control_onOff', array( 'label' => esc_html__( 'Tab 4', 'mega' ), 'pro' => 1, 'value' => 0, 'name' => 'tab_4' )); $form->add_sub_control( 'Mega_Control_Text', array( 'control' => 'tab_4', 'control_value' => 'true', 'label' => esc_html__( 'Title', 'mega' ), 'value' => '', 'name' => 'title_4' )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'tab_4', 'control_value' => 'true', 'label' => esc_html__( 'Widget', 'mega' ), 'pro' => 1, 'value' => '', 'name' => 'widget_4', 'use_list' => 1, 'list' => 'mega_tabs_widget_list' )); } public function addList( $lists ) { $lists['mega_tabs_widget_list'] = esc_html__( 'Tabs Widgets List', 'mega' ); return $lists; } public function doList() { global $mega_registered_blocks, $mega_universal_blocks; foreach( $mega_universal_blocks as $k => $v ) { if ( $v !== $this->mega['args']['id_base'] ) $data[$v] = $mega_registered_blocks[$v]->mega['args']['profile']['name']; } return $data; } public function hookOnce() { add_action( is_admin() ? 'admin_enqueue_scripts' : 'wp_enqueue_scripts', array( &$this, 'enqueue' )); } public function enqueue() { wp_enqueue_script( 'jquery-ui-tabs' ); } public function hook() { add_action( is_admin() ? 'admin_head' : 'wp_head', array( &$this, 'head' )); } public function head() { echo ''; } public function block() { echo '