data['is_bakery'] = true; } return false; } public function after_render( $output, $tag ) { if ( $tag === 'vc_row' || $tag === 'vc_column' ) { $this->data['is_bakery'] = false; } return $output; } /* * Add new label conditions for admin */ public function label_rules( $options ) { $options['Special'][] = array( "name" => __( "WPBakery builder: Is builder block", "advanced-woo-labels" ), "id" => "aws_is_bakery", "type" => "bool", "operators" => "equals", ); return $options; } /* * Add custom condition rule method */ public function condition_rules( $rules ) { $rules['aws_is_bakery'] = array( $this, 'awl_is_bakery' ); return $rules; } /* * Condition: Is WPBakery block */ public function awl_is_bakery( $condition_rule ) { global $product; $match = false; $operator = $condition_rule['operator']; $value = $condition_rule['value']; $compare_value = 'false'; if ( isset( $this->data['is_bakery'] ) && $this->data['is_bakery'] ) { $compare_value = 'true'; } if ( 'equal' == $operator ) { $match = ($compare_value == $value); } elseif ( 'not_equal' == $operator ) { $match = ($compare_value != $value); } return $match; } } endif; AWL_WPBakery::instance();