array( 'name' => esc_html__( 'About', 'mega' ), 'description' => esc_html__( 'About block', 'mega' )), 'universal' => true, 'class_base'=> 'ys-about' ); parent::__construct( __CLASS__, $args ); } public function settings( $form ) { $form->add_control( 'Mega_Control_Select', array( 'label' => esc_html__( 'Title Type', 'mega' ), 'pro' => 1, 'value' => 'text', 'name' => 'title_type', 'choices' => array( 'text' => esc_html__( 'Text', 'mega' ), 'image' => esc_html__( 'Image', 'mega' ) ))); $form->add_sub_control( 'Mega_Control_Text', array( 'control' => 'title_type', 'control_value' => 'text', 'label' => esc_html__( 'Title', 'mega' ), 'value' => esc_html__( 'About Us', 'mega' ), 'name' => 'title' )); $form->add_sub_control( 'Mega_Control_Text', array( 'control' => 'title_type', 'control_value' => 'image', 'label' => esc_html__( 'Image', 'mega' ), 'value' => '', 'name' => 'image' )); $form->add_control( 'Mega_Control_WP_Editor', array( 'label' => esc_html__( 'Text', 'mega' ), 'value' => esc_html__( 'Lorem ipsum dolor sit amet, id elit lorem, id morbi volutpat vitae mauris donec, porta nulla potenti varius tempor nec. mollis sed vel, massa odio interdum pretium malesuada dolornunc.', 'mega' ), 'name' => 'text' )); $form->add_control( 'Mega_Control_onOff', array( 'label' => esc_html__( 'Read More', 'mega' ), 'value' => 1, 'name' => 'rm' )); $form->add_sub_control( 'Mega_Control_Text', array( 'control' => 'rm', 'control_value' => 'true', 'label' => esc_html__( 'Read More URL', 'mega' ), 'value' => '#', 'name' => 'rm_link' )); } public function getTitle() { extract( $this->mega['settings'] ); if ( $title_type === 'text' ) return parent::getTitle(); else return ''; } public function block() { extract( $this->mega['settings'] ); if ( $rm ) $text .= ' more ...'; echo wpautop( $text ); } }