'
', 'universal' => true )); add_filter( 'mega_block_feature_custom_args', array( &$this, 'mega_block_feature_args' )); add_filter( 'mega_block_feature_auto_args', array( &$this, 'mega_block_feature_args' )); parent::__construct( $id_base, $args ); } public function mega_block_feature_args( $args ) { $args['enqueue']['css'] = array( 'id' => 'mega_block_feature', 'path' => '/theme/assets/css/class.Mega_Block_Feature.css' ); return $args; } public function settings( $form ) { $form->add_control( 'Mega_Control_Select', array( 'label' => esc_html__( 'Effect', 'mega' ), 'value' => 'none', 'name' => 'effect', 'choices' => array( 'none' => esc_html__( 'None', 'mega' ), 'chase-to-top' => esc_html__( 'Chase to top', 'mega' ), 'chase-zoom-out' => esc_html__( 'Chase zoom out', 'mega' ) ) )); //$form->add_control( 'Mega_Control_Number', array( 'label' => esc_html__( 'Effect: block height (px)', 'mega' ), 'value' => 350, 'name' => 'effect_height' )); $form->add_control( 'Mega_Control_Select', array( 'label' => esc_html__( 'Alignment', 'mega' ), 'value' => 'center', 'name' => 'alignment', 'choices' => array( 'left' => esc_html__( 'Left', 'mega' ), 'center' => esc_html__( 'Center', 'mega' ), 'right' => esc_html__( 'Right', 'mega' ) ) )); $form->add_control( 'Mega_Control_onOff', array( 'label' => esc_html__( 'Call to action style', 'mega' ), 'name' => 'cta_boost', 'value' => 0 )); $form->add_control( 'Mega_Control_onOff', array( 'label' => esc_html__( 'Show GFX', 'mega' ), 'name' => 'gfx', 'value' => 1 )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'gfx', 'control_value' => 'true', 'label' => esc_html__( 'Image / Icon Position', 'mega' ), 'value' => 'top', 'name' => 'gfx_position', 'choices' => array( 'top' => esc_html__( 'Top', 'mega' ), 'right' => esc_html__( 'Right', 'mega' ), 'bottom' => esc_html__( 'Bottom', 'mega' ), 'left' => esc_html__( 'Left', 'mega' ) ) )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'gfx', 'control_value' => 'true', 'label' => esc_html__( 'Select GFX', 'mega' ), 'value' => 'image', 'name' => 'gfx_type', 'choices' => array( 'image' => esc_html__( 'Image', 'mega' ), 'ion' => esc_html__( 'Ionicons', 'mega' ), 'fa' => esc_html__( 'Font awesome', 'mega' ) ) )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'gfx_type', 'control_value' => 'fa', 'label' => esc_html__( 'Fa Icon', 'mega' ), 'value' => '', 'name' => 'icon', 'use_list' => 1, 'list' => 'mega_fa_icon_list' )); $form->add_sub_control( 'Mega_Control_Select', array( 'control' => 'gfx_type', 'control_value' => 'ion', 'label' => esc_html__( 'Ion Icon', 'mega' ), 'value' => '', 'name' => 'icon2', 'use_list' => 1, 'list' => 'mega_ion_icon_list' )); $form->add_sub_control( 'Mega_Control_Number', array( 'control' => 'gfx_type', 'control_value' => 'image', 'label' => esc_html__( 'Image Width (%)', 'mega' ), 'value' => 100, 'name' => 'width' )); $form->add_sub_control( 'Mega_Control_Number', array( 'control' => 'gfx_type', 'control_value' => 'image', 'label' => esc_html__( 'Image Max Height (px)', 'mega' ), 'value' => 130, 'name' => 'max_height' )); $form->add_control( 'Mega_Control_Text', array( 'label' => esc_html__( 'Title Description', 'mega' ), 'name' => 'title_desc' )); $form->add_control( 'Mega_Control_Select', array( 'label' => esc_html__( 'Title Description Position', 'mega' ), 'value' => 'top', 'name' => 'title_desc_pos', 'choices' => array( 'top' => esc_html__( 'Top', 'mega' ), 'bottom' => esc_html__( 'Bottom', 'mega' ) ) )); $form->add_control( 'Mega_Control_Text', array( 'label' => esc_html__( 'Icon Color', 'mega' ), 'name' => 'color' )); $form->add_control( 'Mega_Control_Number', array( 'label' => esc_html__( 'GFX Width (%)', 'mega' ), 'value' => 40, 'name' => 'gfx_width' )); } public function before() { extract( $this->mega['settings'] ); $this->mega['args']['class'] = array(); if ( isset( $alignment )) $this->mega['args']['class'][0] = 'to-' . $alignment; if ( isset( $gfx ) && $gfx ) { $this->mega['args']['class'][1] = 'gfx-position-' . $gfx_position; $this->mega['args']['class'][2] = 'gfx-type-' . $gfx_type; } if (( isset( $show_title ) && $show_title === 1 ) || ( !isset( $show_title ) && isset( $title ) && !empty( $title ))) { $this->mega['args']['class'][3] = 'show-title'; } if ( isset( $effect ) && $effect !== 'none' ) { //$this->mega['args']['class'][] = 'ys-animate'; $this->mega['args']['class'][1] = 'gfx-position-top'; $this->mega['args']['class'][2] = 'gfx-type-' . $gfx_type; foreach( mega_effect_to_animations( $effect ) as $animation ) $this->mega['args']['class'][] = $animation; } if ( isset( $cta_boost ) && $cta_boost ) { $this->mega['args']['class'][] = 'cta-boost'; } $this->mega['args']['class'][] = 'responsive'; $this->mega['args']['class'][] = 'clamp-3'; $this->mega['args']['class'][] = 'ys-box'; return parent::before(); } public function hook() { add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' )); } public function enqueue() { extract( $this->mega['settings'] ); if ( isset( $effect ) && $effect !== 'none' ) { wp_enqueue_style( 'mega.animate-2', MEGA_DIR_URI . '/assets/css/mega.animate.css' ); wp_enqueue_script( 'mega.jquery.animate', MEGA_DIR_URI . '/assets/js/mega.jquery.animate.js', array( 'jquery' ), false, true ); } if ( $gfx_type === 'fa' && !empty( $icon )) wp_enqueue_style( 'fontawesome' ); else if ( $gfx_type === 'ion' && !empty( $icon2 )) wp_enqueue_style( 'ionicons' ); } public function getIcon() { extract( $this->mega['settings'] ); if ( $gfx_type === 'fa' && !empty( $icon )) return ''; else if ( $gfx_type === 'ion' && !empty( $icon2 )) return ''; } public function autoTagTitle( $link, $text ) { $this->mega['settings']['title'] = mega_auto_tag( 'a', array( 'text' => esc_html( $text ), 'attr' => array( 'href' => $link ) )); } public function getGFX() { extract( $this->mega['settings'] ); if ( $gfx ) { $style = ( $gfx_position === 'left' OR $gfx_position === 'right' ) ? 'width: ' . $gfx_width . '%;' : ''; if ( $gfx_type === 'image' ) { $content = mega_thumb( array( 'custom' => $this->mega['args']['id_base_low'] === 'mega_block_feature_auto' && empty( $image_url ) ? false : $image_url,//isset( $image_url ) ? $image_url : false, 'width' => $width . '%', 'maxheight' => isset( $effect ) && $effect !== 'none' ? ( $effect === 'chase-zoom-out' ? '100p' : '80p' ) : $max_height . 'px', 'sources' => isset( $sources ) ? $sources : array(), 'title' => isset( $image_title ) ? $image_title : '', 'alt' => isset( $image_title ) ? $image_title : '' ), 1 ); } else if ( $gfx_type === 'ion' || $gfx_type === 'fa' ) { $content = $this->getIcon(); } return mega_auto_tag( 'div', array( 'text' => $content, 'attr' => array( 'class' => 'thumb-wrapper trustee', 'style' => $style ) )); } } public function getButton( $link, $label ) { return mega_auto_tag( 'a', array( 'text' => '' . esc_html( $label ) . '', 'attr' => array( 'href' => $link, 'class' => !$this->mega['settings']['button_as_text'] ? 'button' : 'text-button' ), 'bypass' => false )); } public function getWrapper( $content, $style ) { $wrapper = mega_auto_tag( 'div', array( 'text' => $content, 'attr' => array( 'class' => 'true-block-wrapper wrapper cf', 'style' => $style )) ); return mega_auto_tag( 'div', array( 'text' => '' . $wrapper, 'attr' => array( 'class' => 'settlor cf' )) ); } }