start_controls_section( 'eael_wrapper_link_section', [ 'label' => __( ' Wrapper Link', 'essential-addons-for-elementor-lite' ), 'tab' => Controls_Manager::TAB_ADVANCED ] ); $element->add_control( 'eael_wrapper_link_switch', [ 'label' => __( 'Enable Wrapper Link', 'essential-addons-for-elementor-lite' ), 'type' => Controls_Manager::SWITCHER ] ); $element->add_control( 'eael_wrapper_link', [ 'label' => __( 'Link', 'essential-addons-for-elementor-lite' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'eael_wrapper_link_switch!' => '' ] ] ); $element->end_controls_section(); } public function before_render( $element ) { $wrapper_link_settings = $element->get_settings_for_display( 'eael_wrapper_link' ); if ( ! empty( $element->get_settings_for_display( 'eael_wrapper_link_switch' ) ) && ! empty( $wrapper_link_settings['url'] ) ) { $element->add_render_attribute( '_wrapper', 'data-eael-wrapper-link', wp_json_encode( [ 'url' => esc_url( $wrapper_link_settings['url'] ), 'is_external' => esc_attr( $wrapper_link_settings['is_external'] ), 'nofollow' => esc_attr( $wrapper_link_settings['nofollow'] ) ] ) ); } } }