elementor/elementor

Conditions not working on Typography controls.

notrealdev opened this issue · 2 comments

Hi, the below code not working with Typography control
// Typography alway show although date and author switch off

// Date.
$this->add_control(
	'date',
	array(
		'type'         => Controls_Manager::SWITCHER,
		'label'        => esc_html__( 'Publish Date', 'wordpress' ),
		'default'      => '',
		'label_on'     => esc_html__( 'Yes', 'wordpress' ),
		'label_off'    => esc_html__( 'No', 'wordpress' ),
		'return_value' => 'yes',
	)
);
// Author.
$this->add_control(
	'author',
	array(
		'type'         => Controls_Manager::SWITCHER,
		'label'        => esc_html__( 'Author', 'wordpress' ),
		'default'      => '',
		'label_on'     => esc_html__( 'Yes', 'wordpress' ),
		'label_off'    => esc_html__( 'No', 'wordpress' ),
		'return_value' => 'yes',
	)
);

// Typography.
$this->add_group_control(
	Group_Control_Typography::get_type(),
	array(
		'name'       => 'post_meta',
		'label'      => __( 'Typography', 'wordpress' ),
		'scheme'     => Scheme_Typography::TYPOGRAPHY_1,
		'selector'   => '{{WRAPPER}} .meta-item',
		'conditions' => [
			'relation' => 'or',
			'terms'    => [
				[
					'name'     => 'date',
					'operator' => '===',
					'value'    => 'yes',
				],
				[
					'name'     => 'author',
					'operator' => '===',
					'value'    => 'yes',
				],
			],
		],
	)
);

Can you check it?

@notrealdev

It appears there is an issue here, for now, you can wrap the Typography control with a section and run the conditions on the section instead of the Typography control.

Thank you, this issue should be fixed on next version.