name = esc_html__( 'Testimonial', 'et_builder' ); $this->plural = esc_html__( 'Testimonials', 'et_builder' ); $this->slug = 'et_pb_testimonial'; $this->vb_support = 'on'; $this->main_css_element = '%%order_class%%.et_pb_testimonial'; $this->settings_modal_toggles = array( 'general' => array( 'toggles' => array( 'main_content' => esc_html__( 'Text', 'et_builder' ), 'image' => esc_html__( 'Image', 'et_builder' ), 'elements' => esc_html__( 'Elements', 'et_builder' ), ), ), 'advanced' => array( 'toggles' => array( 'icon' => esc_html__( 'Quote Icon', 'et_builder' ), 'text' => array( 'title' => esc_html__( 'Text', 'et_builder' ), 'priority' => 49, ), 'image' => array( 'title' => esc_html__( 'Image', 'et_builder' ), 'priority' => 51, ), 'animation' => array( 'title' => esc_html__( 'Animation', 'et_builder' ), 'priority' => 100, ), ), ), ); $this->advanced_fields = array( 'fonts' => array( 'body' => array( 'label' => esc_html__( 'Body', 'et_builder' ), 'css' => array( 'main' => "{$this->main_css_element} *", ), 'hide_text_shadow' => true, ), ), 'background' => array( 'has_background_color_toggle' => true, 'use_background_color' => true, 'options' => array( 'use_background_color' => array( 'default' => 'on', ), 'background_color' => array( 'depends_show_if' => 'on', 'default' => '#f5f5f5', ), ), 'settings' => array( 'color' => 'alpha', ), ), 'borders' => array( 'default' => array(), 'portrait' => array( 'css' => array( 'main' => array( 'border_radii' => "%%order_class%% .et_pb_testimonial_portrait, %%order_class%% .et_pb_testimonial_portrait:before", 'border_styles' => "%%order_class%% .et_pb_testimonial_portrait", ), ), 'label_prefix' => esc_html__( 'Image', 'et_builder' ), 'tab_slug' => 'advanced', 'toggle_slug' => 'image', 'defaults' => array( 'border_radii' => 'on|90px|90px|90px|90px', 'border_styles' => array( 'width' => '0px', 'color' => '#333333', 'style' => 'solid', ), ), ), ), 'box_shadow' => array( 'default' => array(), 'image' => array( 'label' => esc_html__( 'Image Box Shadow', 'et_builder' ), 'option_category' => 'layout', 'tab_slug' => 'advanced', 'toggle_slug' => 'image', 'css' => array( 'main' => '%%order_class%% .et_pb_testimonial_portrait:before', ), 'default_on_fronts' => array( 'color' => '', 'position' => '', ), ), ), 'margin_padding' => array( 'css' => array( 'important' => 'all', ), ), 'text' => array( 'use_background_layout' => true, 'options' => array( 'text_orientation' => array( 'default' => 'left', ), 'background_layout' => array( 'default' => 'light', 'hover' => 'tabs', ), ), 'css' => array( 'main' => implode(', ', array( '%%order_class%% .et_pb_testimonial_description p', '%%order_class%% .et_pb_testimonial_description a', '%%order_class%% .et_pb_testimonial_description .et_pb_testimonial_author', )) ) ), 'filters' => array( 'child_filters_target' => array( 'tab_slug' => 'advanced', 'toggle_slug' => 'image', ), ), 'image' => array( 'css' => array( 'main' => '%%order_class%% .et_pb_testimonial_portrait', ), ), 'button' => false, ); $this->custom_css_fields = array( 'testimonial_portrait' => array( 'label' => esc_html__( 'Testimonial Portrait', 'et_builder' ), 'selector' => '.et_pb_testimonial_portrait', ), 'testimonial_description' => array( 'label' => esc_html__( 'Testimonial Description', 'et_builder' ), 'selector' => '.et_pb_testimonial_description', ), 'testimonial_author' => array( 'label' => esc_html__( 'Testimonial Author', 'et_builder' ), 'selector' => '.et_pb_testimonial_author', ), 'testimonial_meta' => array( 'label' => esc_html__( 'Testimonial Meta', 'et_builder' ), 'selector' => '.et_pb_testimonial_meta', ), ); $this->help_videos = array( array( 'id' => esc_html( 'FkQuawiGWUw' ), 'name' => esc_html__( 'An introduction to the Testimonial module', 'et_builder' ), ), ); } function get_fields() { $fields = array( 'author' => array( 'label' => esc_html__( 'Author Name', 'et_builder' ), 'type' => 'text', 'option_category' => 'basic_option', 'description' => esc_html__( 'Input the name of the testimonial author.', 'et_builder' ), 'toggle_slug' => 'main_content', 'dynamic_content' => 'text', ), 'job_title' => array( 'label' => esc_html__( 'Job Title', 'et_builder' ), 'type' => 'text', 'option_category' => 'basic_option', 'description' => esc_html__( 'Input the job title.', 'et_builder' ), 'toggle_slug' => 'main_content', 'dynamic_content' => 'text', ), 'company_name' => array( 'label' => esc_html__( 'Company Name', 'et_builder' ), 'type' => 'text', 'option_category' => 'basic_option', 'description' => esc_html__( 'Input the name of the company.', 'et_builder' ), 'toggle_slug' => 'main_content', 'dynamic_content' => 'text', ), 'url' => array( 'label' => esc_html__( 'Company Link URL', 'et_builder' ), 'type' => 'text', 'option_category' => 'basic_option', 'description' => esc_html__( 'Input the website of the author or leave blank for no link.', 'et_builder' ), 'toggle_slug' => 'link_options', 'dynamic_content' => 'url', ), 'url_new_window' => array( 'label' => esc_html__( 'Company Link Target', 'et_builder' ), 'type' => 'select', 'option_category' => 'configuration', 'options' => array( 'off' => esc_html__( 'In The Same Window', 'et_builder' ), 'on' => esc_html__( 'In The New Tab', 'et_builder' ), ), 'toggle_slug' => 'link_options', 'description' => esc_html__( 'Choose whether or not the URL should open in a new window.', 'et_builder' ), 'default_on_front' => 'off', ), 'portrait_url' => array( 'label' => esc_html__( 'Portrait Image URL', 'et_builder' ), 'type' => 'upload', 'option_category' => 'basic_option', 'upload_button_text' => esc_attr__( 'Upload an image', 'et_builder' ), 'choose_text' => esc_attr__( 'Choose an Image', 'et_builder' ), 'update_text' => esc_attr__( 'Set As Image', 'et_builder' ), 'description' => esc_html__( 'Upload your desired image, or type in the URL to the image you would like to display.', 'et_builder' ), 'toggle_slug' => 'image', 'dynamic_content' => 'image', ), 'quote_icon' => array( 'label' => esc_html__( 'Show Quote Icon', 'et_builder' ), 'type' => 'yes_no_button', 'option_category' => 'configuration', 'options' => array( 'on' => esc_html__( 'Yes', 'et_builder' ), 'off' => esc_html__( 'No', 'et_builder' ), ), 'default_on_front' => 'on', 'description' => esc_html__( 'Choose whether or not the quote icon should be visible.', 'et_builder' ), 'toggle_slug' => 'elements', ), 'content' => array( 'label' => esc_html__( 'Content', 'et_builder' ), 'type' => 'tiny_mce', 'option_category' => 'basic_option', 'description' => esc_html__( 'Input the main text content for your module here.', 'et_builder' ), 'toggle_slug' => 'main_content', 'dynamic_content' => 'text', ), 'quote_icon_color' => array( 'label' => esc_html__( 'Quote Icon Color', 'et_builder' ), 'type' => 'color-alpha', 'custom_color' => true, 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'hover' => 'tabs', ), 'quote_icon_background_color' => array( 'label' => esc_html__( 'Quote Icon Background Color', 'et_builder' ), 'type' => 'color-alpha', 'custom_color' => true, 'tab_slug' => 'advanced', 'toggle_slug' => 'icon', 'default' => '#f5f5f5', 'default_on_front' => '', 'hover' => 'tabs', ), 'portrait_width' => array( 'label' => esc_html__( 'Portrait Width', 'et_builder' ), 'type' => 'range', 'option_category' => 'layout', 'tab_slug' => 'advanced', 'toggle_slug' => 'image', 'default_unit' => 'px', 'range_settings' => array( 'min' => '1', 'max' => '200', 'step' => '1', ), ), 'portrait_height' => array( 'label' => esc_html__( 'Portrait Height', 'et_builder' ), 'type' => 'range', 'option_category' => 'layout', 'tab_slug' => 'advanced', 'toggle_slug' => 'image', 'range_settings' => array( 'min' => '1', 'max' => '200', 'step' => '1', ), ), ); return $fields; } public function get_transition_fields_css_props() { $fields = parent::get_transition_fields_css_props(); $fields['quote_icon_color'] = array( 'color' => '%%order_class%%.et_pb_testimonial:before' ); $fields['quote_icon_background_color'] = array( 'background-color' => '%%order_class%%.et_pb_testimonial:before' ); return $fields; } public function get_transition_image_fields_css_props() { $fields = parent::get_transition_image_fields_css_props(); $fields = array_merge( $this->get_transition_borders_fields_css_props( 'portrait' ), $fields ); return $fields; } function render( $attrs, $content = null, $render_slug ) { // Allowing full html for backwards compatibility. $author = $this->_esc_attr( 'author', 'full' ); $job_title = $this->_esc_attr( 'job_title' ); $portrait_url = $this->props['portrait_url']; // Allowing full html for backwards compatibility. $company_name = $this->_esc_attr( 'company_name', 'full' ); $url = $this->props['url']; $quote_icon = $this->props['quote_icon']; $url_new_window = $this->props['url_new_window']; $use_background_color = $this->props['use_background_color']; $background_color = $this->props['background_color']; $background_color_hover = $this->get_hover_value( 'background_color' ); $background_layout = $this->props['background_layout']; $background_layout_hover = et_pb_hover_options()->get_value( 'background_layout', $this->props, 'light' ); $background_layout_hover_enabled = et_pb_hover_options()->is_enabled( 'background_layout', $this->props ); $quote_icon_color = $this->props['quote_icon_color']; $quote_icon_color_hover = $this->get_hover_value('quote_icon_color'); $quote_icon_background_color = $this->props['quote_icon_background_color']; $quote_icon_background_color_hover = $this->get_hover_value('quote_icon_background_color'); $portrait_width = $this->props['portrait_width']; $portrait_height = $this->props['portrait_height']; if ( '' !== $portrait_width ) { ET_Builder_Element::set_style( $render_slug, array( 'selector' => '%%order_class%% .et_pb_testimonial_portrait', 'declaration' => sprintf( 'width: %1$s;', esc_html( et_builder_process_range_value( $portrait_width ) ) ), ) ); } if ( '' !== $portrait_height ) { ET_Builder_Element::set_style( $render_slug, array( 'selector' => '%%order_class%% .et_pb_testimonial_portrait', 'declaration' => sprintf( 'height: %1$s;', esc_html( et_builder_process_range_value( $portrait_height ) ) ), ) ); } if ( '' !== $quote_icon_color ) { ET_Builder_Element::set_style( $render_slug, array( 'selector' => '%%order_class%%.et_pb_testimonial:before', 'declaration' => sprintf( 'color: %1$s;', esc_html( $quote_icon_color ) ), ) ); } if ( et_builder_is_hover_enabled( 'quote_icon_color', $this->props ) ) { ET_Builder_Element::set_style( $render_slug, array( 'selector' => '%%order_class%%.et_pb_testimonial:hover:before', 'declaration' => sprintf( 'color: %1$s;', esc_html( $quote_icon_color_hover ) ), ) ); } if ( '' !== $quote_icon_background_color ) { ET_Builder_Element::set_style( $render_slug, array( 'selector' => '%%order_class%%.et_pb_testimonial:before', 'declaration' => sprintf( 'background-color: %1$s;', esc_html( $quote_icon_background_color ) ), ) ); } if ( et_builder_is_hover_enabled( 'quote_icon_background_color', $this->props ) ) { ET_Builder_Element::set_style( $render_slug, array( 'selector' => '%%order_class%%.et_pb_testimonial:hover:before', 'declaration' => sprintf( 'background-color: %1$s;', esc_html( $quote_icon_background_color_hover ) ), ) ); } $portrait_image = ''; $video_background = $this->video_background(); $parallax_image_background = $this->get_parallax_image_background(); if ( '' !== $portrait_url ) { $portrait_image = sprintf( '