From fda2e28c49f3f2a0c2b5dabec9fa08b5d9110cbe Mon Sep 17 00:00:00 2001 From: soufiane Date: Mon, 2 Dec 2024 17:19:45 +0100 Subject: [PATCH] wait #7216 --- .../physioassist/src/Elementor/Setup.php | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/wp-content/mu-plugins/physioassist/src/Elementor/Setup.php b/wp-content/mu-plugins/physioassist/src/Elementor/Setup.php index dd050e5d..d294a480 100644 --- a/wp-content/mu-plugins/physioassist/src/Elementor/Setup.php +++ b/wp-content/mu-plugins/physioassist/src/Elementor/Setup.php @@ -22,20 +22,14 @@ class Setup { //--- Heading Widget // Extend Elementor's heading widget to add a CSS class based on the alignment setting so we can also control the position of the underline - add_action( 'elementor/element/heading/section_title/before_section_end', function( $element, $args ) { - $elementor = Plugin::instance(); - - // Get the align control for updating - $control_data = $elementor->controls_manager->get_control_from_stack( $element->get_name(), 'align' ); - - if (is_wp_error($control_data)) { - return; + add_action( 'elementor/widget/before_render_content', function( $widget ) { + if ('heading' === $widget->get_name()) { + $settings = $widget->get_settings(); + if ( ! empty( $settings['align'] ) ) { + $widget->add_render_attribute('_wrapper', 'class', 'heading-align-'. $settings['align']); + } } - - // Add a prefix class so heading will have correct class applied when alignment is changed - $control_data['prefix_class'] = 'heading-align-'; - $element->update_control( 'align', $control_data ); - }, 10, 2); + }); // Todo: consider add a control to the existing heading widget that allows the underline to be disabled (via prefix_class?) -- 2.39.5