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

Controls_Manager::add_tab Stops Working with 2.9.0 #10511

Open
meceware opened this issue Feb 12, 2020 · 2 comments
Open

Controls_Manager::add_tab Stops Working with 2.9.0 #10511

meceware opened this issue Feb 12, 2020 · 2 comments

Comments

@meceware
Copy link

Hi,

Starting from 2.9.0 (beta5), Controls_Manager::add_tab stops working. Page Settings tabs cannot be routed.

image

The tab can be added and shown without problem with this code.

use Elementor\Controls_Manager;

// Called from 'elementor/init' action
Controls_Manager::add_tab( 'my-tab', 'My Tab' );
      add_action( 'elementor/element/wp-page/document_settings/after_section_end', array( $this, 'after_section_end' ), 10, 2 );

public function after_section_end( $page, $args ) {
  print_r(Controls_Manager::get_tabs());

  $page->start_controls_section(
    'my-tab-activate',
    array(
      'label' => 'My Tab Label',
      'tab' => 'my-tab', // NOT WORKING
      // 'tab' => Controls_Manager::TAB_SETTINGS, // WORKING
    )
  );

  $page->add_control(
    'my-tab-enabled-disabled',
    array(
      'label' => 'Enable',
      'type' => Controls_Manager::SWITCHER,
      'default' => 'no',
      'label_on' => 'Yes',
      'label_off' => 'No',
      'return_value' => 'yes',
    )
  );

  $page->end_controls_section();
}

This code is working with 2.8.5 however starting from 2.9.0, the page receives the error below and the tab cannot be shown. The error is received when the tab is clicked.

image

Is there any other way to add tabs to Page Settings?

@meceware
Copy link
Author

Environment:
WordPress 5.3.2
Only Elementor and the plugin with this code activated.

@shilo-ey shilo-ey changed the title Controls_Manager::add_tab Stops Working with 2.9.0 (beta5) Controls_Manager::add_tab Stops Working with 2.9.0 Feb 17, 2020
@nicolas-jaussaud
Copy link

I'm still experiencing the same issue in Elementor 3.3.0.

The issue happen only if the built-in "Content" tab is not defined and we use custom tabs.

When the "Content" tab is defined, it's possible to display a custom tab. If there is only custom tabs however, we will run into the "Routes: panel/editor/custom-tab-name" error when trying to access it.

It looks like it's an issue with the default tab, which apparently can only be a built-in one (like "Content" or "Advanced") currently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants