• Resolved stas0238

    (@stas0238)


    Hello,
    I have added extra control sections with options in Advanced Tab using elementor/element/common/_section_style/before_section_start action to make it added globally for all widgets.
    But I need to update some options’ values (of switcher control type) for just few specific widgets (‘image-carousel’, ‘testimonial’, etc)
    How can I do it with normal code practice ?
    My tries:
    1/

    add_action('elementor/element/image-carousel/_section_style/before_section_start', function($element, $args) {
    $element->update_control( 'my_custom_option', [
    			'default' => 'yes',
    		] );
    }, 10, 2);

    2/

    add_action('elementor/element/after_section_start', function( $element, $section_id, $args ) {
    if ( 'image-carousel' === $element->get_name() ) {
      $element->update_control( 'my_custom_option', [
      			'default' => 'yes',
    		] );
      }, 10, 3)
    }

    The result I would like to have is next:
    1/ Have my extra sections with options for all widgets
    2/ For specific widgets default values of few controls should be changed. ->

    Globally

    $element->add_control(
            'my_custom_option',
            [
                'label' => __('Label', 'xstore'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
            ]
        );

    But for some widgets it should be kinda next view

    $element->add_control(
            'my_custom_option',
            [
                'label' => __('Label', 'xstore'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'default' => 'yes'
            ]
        );
    • This topic was modified 1 year, 10 months ago by stas0238.
    • This topic was modified 1 year, 10 months ago by stas0238.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Advanced Section options’ is closed to new replies.