class ET_Builder_Module_Testimonial extends ET_Builder_Module {
$this->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(
'main_content' => et_builder_i18n( 'Text' ),
'image' => et_builder_i18n( 'Image' ),
'elements' => et_builder_i18n( 'Elements' ),
'icon' => esc_html__( 'Quote Icon', 'et_builder' ),
'title' => et_builder_i18n( 'Text' ),
'title' => et_builder_i18n( 'Image' ),
'title' => esc_html__( 'Animation', 'et_builder' ),
$this->advanced_fields = array(
'label' => et_builder_i18n( 'Body' ),
'main' => "{$this->main_css_element} *",
'hide_text_shadow' => true,
'block_elements' => array(
'tabbed_subtoggles' => true,
'bb_icons_support' => true,
'label' => esc_html__( 'Author', 'et_builder' ),
'main' => "{$this->main_css_element} .et_pb_testimonial_author",
'default' => '|700|||||||',
'default' => floatval( et_get_option( 'body_font_height', '1.5' ) ) . 'em',
'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px',
'letter_spacing' => array(
'label' => et_builder_i18n( 'Position' ),
'main' => "{$this->main_css_element} .et_pb_testimonial_position, {$this->main_css_element} .et_pb_testimonial_separator",
'hide_text_align' => true,
'default' => floatval( et_get_option( 'body_font_height', '1.5' ) ) . 'em',
'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px',
'letter_spacing' => array(
'label' => esc_html__( 'Company', 'et_builder' ),
'main' => "{$this->main_css_element} .et_pb_testimonial_company, {$this->main_css_element} .et_pb_testimonial_company a",
'hide_text_align' => true,
'default' => floatval( et_get_option( 'body_font_height', '1.5' ) ) . 'em',
'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px',
'letter_spacing' => array(
'has_background_color_toggle' => true,
'use_background_color' => true,
'use_background_color' => array(
'background_color' => array(
'depends_show_if' => 'on',
'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' => et_builder_i18n( 'Image' ),
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'border_radii' => 'on|90px|90px|90px|90px',
'border_styles' => array(
'label' => esc_html__( 'Image Box Shadow', 'et_builder' ),
'option_category' => 'layout',
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'main' => '%%order_class%% .et_pb_testimonial_portrait:before',
'default_on_fronts' => array(
'margin_padding' => array(
'use_background_layout' => true,
'text_orientation' => array(
'background_layout' => 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',
'child_filters_target' => array(
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'main' => '%%order_class%% .et_pb_testimonial_portrait',
'position_fields' => array(
$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(
'name' => esc_html__( 'An introduction to the Testimonial module', 'et_builder' ),
'label' => esc_html__( 'Author', 'et_builder' ),
'option_category' => 'basic_option',
'description' => esc_html__( 'Input the name of the testimonial author.', 'et_builder' ),
'toggle_slug' => 'main_content',
'dynamic_content' => 'text',
'mobile_options' => true,
'label' => esc_html__( 'Job Title', 'et_builder' ),
'option_category' => 'basic_option',
'description' => esc_html__( 'Input the job title.', 'et_builder' ),
'toggle_slug' => 'main_content',
'dynamic_content' => 'text',
'mobile_options' => true,
'label' => esc_html__( 'Company', 'et_builder' ),
'option_category' => 'basic_option',
'description' => esc_html__( 'Input the name of the company.', 'et_builder' ),
'toggle_slug' => 'main_content',
'dynamic_content' => 'text',
'mobile_options' => true,
'label' => esc_html__( 'Company Link URL', 'et_builder' ),
'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' ),
'option_category' => 'configuration',
'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',
'label' => et_builder_i18n( 'Image' ),
'option_category' => 'basic_option',
'upload_button_text' => et_builder_i18n( 'Upload an image' ),
'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',
'mobile_options' => true,
'label' => esc_html__( 'Show Quote Icon', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'on' => et_builder_i18n( 'Yes' ),
'off' => et_builder_i18n( 'No' ),
'default_on_front' => 'on',
'description' => esc_html__( 'Choose whether or not the quote icon should be visible.', 'et_builder' ),
'toggle_slug' => 'elements',
'mobile_options' => true,
'label' => et_builder_i18n( 'Body' ),
'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',
'mobile_options' => true,
'quote_icon_color' => array(
'label' => esc_html__( 'Quote Icon Color', 'et_builder' ),
'description' => esc_html__( 'Here you can define a custom color for the quote icon.', 'et_builder' ),
'tab_slug' => 'advanced',
'mobile_options' => true,
'quote_icon_background_color' => array(
'label' => esc_html__( 'Quote Icon Background Color', 'et_builder' ),
'description' => esc_html__( 'Pick a color to use for the circular background area behind the quote icon.', 'et_builder' ),
'tab_slug' => 'advanced',
'default_on_front' => '',
'mobile_options' => true,
'portrait_width' => array(
'label' => esc_html__( 'Image Width', 'et_builder' ),
'description' => esc_html__( "Adjust the width of the person's portrait photo within the testimonial.", 'et_builder' ),
'option_category' => 'layout',
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
'mobile_options' => true,
'portrait_height' => array(
'label' => esc_html__( 'Image Height', 'et_builder' ),
'description' => esc_html__( "Adjust the height of the person's portrait photo within the testimonial.", 'et_builder' ),
'option_category' => 'layout',
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'allowed_units' => array( 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
'mobile_options' => true,
'use_icon_font_size' => array(
'label' => esc_html__( 'Use Custom Quote Icon Size', 'et_builder' ),
'description' => esc_html__( 'If you would like to control the size of the icon, you must first enable this option.', 'et_builder' ),
'type' => 'yes_no_button',
'off' => et_builder_i18n( 'No' ),
'on' => et_builder_i18n( 'Yes' ),
'default_on_front' => 'off',
'tab_slug' => 'advanced',
'option_category' => 'font_option',
'icon_font_size' => array(
'label' => esc_html__( 'Quote Icon Font Size', 'et_builder' ),
'description' => esc_html__( 'Control the size of the icon by increasing or decreasing the font size.', 'et_builder' ),
'option_category' => 'font_option',
'tab_slug' => 'advanced',
'default_on_front' => '',
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
'range_settings' => array(
'mobile_options' => true,
'depends_show_if' => 'on',
public function get_transition_fields_css_props() {
$fields = parent::get_transition_fields_css_props();
$fields['portrait_width'] = array( 'width' => '%%order_class%% .et_pb_testimonial_portrait' );
$fields['portrait_height'] = array( 'height' => '%%order_class%% .et_pb_testimonial_portrait' );
$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' );
$fields['icon_font_size'] = array(
'font-size' => '%%order_class%%:before',
'border-radius' => '%%order_class%%:before',
'height' => '%%order_class%% .et-fb-quick-access-item-testimonial-icon',
'width' => '%%order_class%% .et-fb-quick-access-item-testimonial-icon',
'top' => '%%order_class%%:before, %%order_class%% .et-fb-quick-access-item-testimonial-icon',
'margin-left' => '%%order_class%%:before, %%order_class%% .et-fb-quick-access-item-testimonial-icon',
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 );
* Renders the module output.
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
public function render( $attrs, $content, $render_slug ) {
$multi_view = et_pb_multi_view_options( $this );
// 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' );
$use_icon_font_size = $this->props['use_icon_font_size'];
$icon_font_size_values = et_pb_responsive_options()->get_property_values( $this->props, 'icon_font_size' );
'base_attr_name' => 'portrait_width',
'selector' => '%%order_class%% .et_pb_testimonial_portrait',
'sticky_pseudo_selector_location' => 'prefix',
'css_property' => 'width',
'render_slug' => $render_slug,
'base_attr_name' => 'portrait_height',
'selector' => '%%order_class%% .et_pb_testimonial_portrait',
'sticky_pseudo_selector_location' => 'prefix',
'css_property' => 'height',
'render_slug' => $render_slug,
'base_attr_name' => 'quote_icon_color',
'selector' => '%%order_class%%.et_pb_testimonial:before',
'hover_pseudo_selector_location' => 'suffix',