Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condition with tabs control #6830

Closed
wayheming opened this issue Jan 22, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@wayheming
Copy link
Contributor

commented Jan 22, 2019

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest stable version of Elementor.

Description

Hello. If I make the tab control dependency on any option, it is not completely hidden and padding remains. Classes elementor-hidden-control are not added for wrapper. http://prntscr.com/mahshi

Steps to reproduce

Make any tab control dependent on any option.

Isolating the problem

  • This bug happens with only Elementor plugin active (and Elementor Pro).
  • This bug happens with a default WordPress theme active.
  • I can reproduce this bug consistently using the steps above.
@shilo-ey

This comment has been minimized.

Copy link
Collaborator

commented Jan 22, 2019

Hi @wayheming

Please attach the code you've added so we can see what is the problem.

thanks

@wayheming

This comment has been minimized.

Copy link
Contributor Author

commented Jan 22, 2019

Hello @shilo-ey

$this->add_control(
	'shadow_switcher',
	[
		'label'        => esc_html__( 'Shadow', 'theme' ),
		'type'         => Controls_Manager::SWITCHER,
		'default'      => 'no',
		'label_on'     => esc_html__( 'Yes', 'theme' ),
		'label_off'    => esc_html__( 'No', 'theme' ),
		'return_value' => 'yes',
	]
);

$this->start_controls_tabs( 'shadow_tabs' );

$this->start_controls_tab(
	'shadow_normal_tab',
	[
		'label'     => esc_html__( 'Normal', 'theme' ),
		'condition' => [
			'shadow_switcher' => [ 'yes' ],
		],
	]
);

$this->add_control(
	'shadow',
	[
		'label'     => esc_html__( 'Shadow', 'theme' ),
		'type'      => Controls_Manager::BOX_SHADOW,
		'selectors' => [
			$selector => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}};',
		],
		'default'   => [
			'horizontal' => '0',
			'vertical'   => '0',
			'blur'       => '3',
			'spread'     => '0',
			'color'      => 'rgba(0,0,0,0.15)',
		],
		'condition' => [
			'shadow_switcher' => [ 'yes' ],
		],
	]
);

$this->end_controls_tab();

$this->start_controls_tab(
	'shadow_hover_tab',
	[
		'label'     => esc_html__( 'Hover', 'theme' ),
		'condition' => [
			'shadow_switcher' => [ 'yes' ],
		],
	]
);

$this->add_control(
	'shadow_hover',
	[
		'label'     => esc_html__( 'Shadow', 'theme' ),
		'type'      => Controls_Manager::BOX_SHADOW,
		'selectors' => [
			$hover_selector => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}};',
		],
		'default'   => [
			'horizontal' => '',
			'vertical'   => '',
			'blur'       => '',
			'spread'     => '',
			'color'      => '',
		],
		'condition' => [
			'shadow_switcher' => [ 'yes' ],
		],
	]
);

$this->end_controls_tab();

$this->end_controls_tabs();
@shilo-ey

This comment has been minimized.

Copy link
Collaborator

commented Jan 22, 2019

Hi @wayheming

Thanks for reporting.

We will add in the next Core release a modification for this issue, and now you will be able to set conditions to the entire tab instead of each control separately.

In your case you will need to alter your code to something like this:

$this->start_controls_tabs( 'shadow_tabs', [
    'condition' => [
        'shadow_switcher' => [ 'yes' ],
    ],
] );

Hence, you will not have to set multiple conditions for each control.

Thanks

@wayheming

This comment has been minimized.

Copy link
Contributor Author

commented Jan 22, 2019

@shilo-ey thanks a lot it's even better

@KingYes KingYes closed this in e0bcdc2 Jan 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.