: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Description class
* The ET_Builder_Module_Woocommerce_Description Class is responsible for rendering the
* Description markup using the WooCommerce template.
* Class representing WooCommerce Description component.
class ET_Builder_Module_Woocommerce_Description extends ET_Builder_Module {
* @since 4.0.6 Updated `toggle_slug` to avoid empty Tabs in Text OG.
$this->name = esc_html__( 'Woo Description', 'et_builder' );
$this->plural = esc_html__( 'Woo Descriptions', 'et_builder' );
$this->slug = 'et_pb_wc_description';
$this->vb_support = 'on';
$this->settings_modal_toggles = array(
'main_content' => et_builder_i18n( 'Content' ),
'title' => et_builder_i18n( 'Text' ),
'tabbed_subtoggles' => true,
'bb_icons_support' => true,
'icon' => 'numbered-list',
'title' => esc_html__( 'Heading Text', 'et_builder' ),
'tabbed_subtoggles' => true,
'title' => et_builder_i18n( 'Sizing' ),
$this->advanced_fields = array(
'label' => et_builder_i18n( 'Text' ),
'line_height' => '%%order_class%% p',
'color' => '%%order_class%%.et_pb_wc_description',
'default' => floatval( et_get_option( 'body_font_height', '1.7' ) ) . 'em',
'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px',
'hide_text_align' => true,
'label' => et_builder_i18n( 'Link' ),
'main' => '%%order_class%% a',
'color' => '%%order_class%%.et_pb_wc_description a',
'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px',
'hide_text_align' => true,
'label' => esc_html__( 'Unordered List', 'et_builder' ),
'main' => '%%order_class%% ul',
'color' => '%%order_class%%.et_pb_wc_description ul',
'line_height' => '%%order_class%% ul li',
'label' => esc_html__( 'Ordered List', 'et_builder' ),
'main' => '%%order_class%% ol',
'color' => '%%order_class%%.et_pb_wc_description ol',
'line_height' => '%%order_class%% ol li',
'label' => esc_html__( 'Blockquote', 'et_builder' ),
'main' => '%%order_class%% blockquote',
'color' => '%%order_class%%.et_pb_wc_description blockquote',
'label' => esc_html__( 'Heading', 'et_builder' ),
'main' => '%%order_class%% h1',
'default' => absint( et_get_option( 'body_header_size', '30' ) ) . 'px',
'toggle_slug' => 'header',
'label' => esc_html__( 'Heading 2', 'et_builder' ),
'main' => '%%order_class%% h2',
'toggle_slug' => 'header',
'label' => esc_html__( 'Heading 3', 'et_builder' ),
'main' => '%%order_class%% h3',
'toggle_slug' => 'header',
'label' => esc_html__( 'Heading 4', 'et_builder' ),
'main' => '%%order_class%% h4',
'toggle_slug' => 'header',
'label' => esc_html__( 'Heading 5', 'et_builder' ),
'main' => '%%order_class%% h5',
'toggle_slug' => 'header',
'label' => esc_html__( 'Heading 6', 'et_builder' ),
'main' => '%%order_class%% h6',
'toggle_slug' => 'header',
'margin_padding' => array(
'use_background_layout' => true,
'text_orientation' => array(
'background_layout' => array(
// Don't add text-shadow fields since they already are via font-options.
$this->help_videos = array(
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
public function get_fields() {
'product' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'default' => ET_Builder_Module_Helper_Woocommerce_Modules::get_product_default(),
'computed_affects' => array(
'product_filter' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'computed_affects' => array(
'description_type' => array(
'label' => esc_html__( 'Description Type', 'et_builder' ),
'option_category' => 'configuration',
'description' => esc_html__( 'Description', 'et_builder' ),
'short_description' => esc_html__( 'Short Description', 'et_builder' ),
'toggle_slug' => 'main_content',
'description' => esc_html__( 'Here you can choose between Description and short description to display.', 'et_builder' ),
'default_on_front' => 'short_description',
'mobile_options' => true,
'computed_affects' => array(
'__description' => array(
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Description',
'computed_depends_on' => array(
'computed_minimum' => array(
* @param array $args Additional arguments.
public static function get_description( $args = array(), $conditional_tags = array(), $current_page = array() ) {
'description_type' => 'short_description',
$args = wp_parse_args( $args, $defaults );
// Theme builder's description placeholder; short-circuit is cleaner and more efficient than
// global object element being modified. NOTE: $conditional_tags element value is string
if ( et_builder_tb_enabled() || 'true' === et_()->array_get( $conditional_tags, 'is_tb', false ) ) {
$placeholders = et_theme_builder_wc_placeholders();
$description = 'short_description' === $args['description_type'] ?
$placeholders['short_description'] :
$placeholders['description'];
// Description comes from Post Content or Excerpt or Custom Field which is processed by WP and should be properly escaped during save.
return et_core_intentionally_unescaped( $description, 'html' );
$post_id = ET_Builder_Module_Helper_Woocommerce_Modules::get_product_id( $args['product'] );
$post = get_post( $post_id );
if ( ! ( $post instanceof WP_Post ) ) {
if ( 'description' === $args['description_type'] ) {
// If builder is not used on given post, display post content.
if ( ! et_pb_is_pagebuilder_used( $post_id ) ) {
/** This filter is documented in wp-includes/post-template.php */
$description = apply_filters( 'the_content', $post->post_content );
$description = get_post_meta( $post->ID, ET_BUILDER_WC_PRODUCT_LONG_DESC_META_KEY, true );
// Cannot use `the_content` filter since it adds content wrapper.
// Content wrapper added at
// `includes/builder/core.php`::et_builder_add_builder_content_wrapper()
// This filter is documented at
// includes/builder/feature/woocommerce-modules.php
$description = apply_filters( 'et_builder_wc_description', $description );
$description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );
// Description comes from Post Content or Excerpt or Custom Field which is processed by WP and should be properly escaped during save.
return et_core_intentionally_unescaped( $description, 'html' );
* Adds Multi view attributes to the Outer wrapper.
* Since we do not have control over the WooCommerce Breadcrumb markup, we inject Multi view
* attributes on to the Outer wrapper.
* @param array $outer_wrapper_attrs
* @param ET_Builder_Module_Woocommerce_Description $this_class
public function add_multi_view_attrs( $outer_wrapper_attrs, $this_class ) {
$multi_view = et_pb_multi_view_options( $this_class );
$multi_view_attrs = $multi_view->render_attrs( array(
'content' => '{{description_type}}',
'target' => '%%order_class%% .et_pb_module_inner',
if ( $multi_view_attrs && is_array( $multi_view_attrs ) ) {
$outer_wrapper_attrs = array_merge( $outer_wrapper_attrs, $multi_view_attrs );
return $outer_wrapper_attrs;
* Filter multi view value.
* @see ET_Builder_Module_Helper_MultiViewOptions::filter_value
* @param mixed $raw_value Props raw value.
* @type string $context Context param: content,
* attrs, visibility, classes.
* @type string $name Module options props name.
* @type string $mode Current data mode: desktop,
* @type string $attr_key Attribute key for attrs
* context data. Example: src, class, etc.
* @type string $attr_sub_key Attribute sub key that
* availabe when passing attrs value as array such as styes. Example: padding-top,
* @param ET_Builder_Module_Helper_MultiViewOptions $multi_view Multiview object instance.
public function multi_view_filter_value( $raw_value, $args, $multi_view ) {
if ( empty( $multi_view->get_module_props() ) ) {
$maybe_product = et_()->array_get( $multi_view->get_module_props(), 'product', '0' );
$product = ET_Builder_Module_Helper_Woocommerce_Modules::get_product( $maybe_product );
$name = et_()->array_get( $args, 'name', '' );
$mode = et_()->array_get( $args, 'mode', '' );
$post = get_post( $product->get_id() );
// Validating $post validates $post_id. No separate $post_id validation is required.
if ( 'description_type' !== $name || ! $post ) {
if ( 'description' === $multi_view->get_inherit_value( $name, $mode ) ) {
if ( ! et_pb_is_pagebuilder_used( $product->get_id() ) ) {
$raw_value = $post->post_content;