← All changes
|
modules/nested-accordion/widgets/nested-accordion.php
+27
-45
4.3.0
→
3.26.2
View file →
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | use Elementor\Utils; |
| 15 | 15 | use Elementor\Group_Control_Text_Stroke; |
| 16 | 16 | |
| 17 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | - exit; // Exit if accessed directly. | |
| 18 | + exit; // Exit if accessed directly | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Elementor Nested Accordion widget. |
| @@ -30,12 +30,8 @@ | ||
| 30 | 30 | |
| 31 | 31 | private $optimized_markup = null; |
| 32 | 32 | private $widget_container_selector = ''; |
| 33 | 33 | |
| 34 | - protected function is_dynamic_content(): bool { | |
| 35 | - return true; | |
| 36 | - } | |
| 37 | - | |
| 38 | 34 | public function get_name() { |
| 39 | 35 | return 'nested-accordion'; |
| 40 | 36 | } |
| 41 | 37 | |
| @@ -55,9 +51,9 @@ | ||
| 55 | 51 | return [ 'widget-nested-accordion' ]; |
| 56 | 52 | } |
| 57 | 53 | |
| 58 | 54 | public function show_in_panel(): bool { |
| 59 | - return Plugin::$instance->experiments->is_feature_active( 'container' ); | |
| 55 | + return Plugin::$instance->experiments->is_feature_active( 'nested-elements', true ); | |
| 60 | 56 | } |
| 61 | 57 | |
| 62 | 58 | public function has_widget_inner_wrapper(): bool { |
| 63 | 59 | return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| @@ -66,13 +62,9 @@ | ||
| 66 | 62 | protected function item_content_container( int $index ) { |
| 67 | 63 | return [ |
| 68 | 64 | 'elType' => 'container', |
| 69 | 65 | 'settings' => [ |
| 70 | - '_title' => sprintf( | |
| 71 | - /* translators: %d: Item index. */ | |
| 72 | - __( 'item #%d', 'elementor' ), | |
| 73 | - $index | |
| 74 | - ), | |
| 66 | + '_title' => sprintf( __( 'item #%s', 'elementor' ), $index ), | |
| 75 | 67 | 'content_width' => 'full', |
| 76 | 68 | ], |
| 77 | 69 | ]; |
| 78 | 70 | } |
| @@ -89,9 +81,8 @@ | ||
| 89 | 81 | return 'item_title'; |
| 90 | 82 | } |
| 91 | 83 | |
| 92 | 84 | protected function get_default_children_title() { |
| 93 | - /* translators: %d: Item index. */ | |
| 94 | 85 | return esc_html__( 'Item #%d', 'elementor' ); |
| 95 | 86 | } |
| 96 | 87 | |
| 97 | 88 | protected function get_default_children_placeholder_selector() { |
| @@ -166,9 +157,9 @@ | ||
| 166 | 157 | 'item_title' => esc_html__( 'Item #3', 'elementor' ), |
| 167 | 158 | ], |
| 168 | 159 | ], |
| 169 | 160 | 'title_field' => '{{{ item_title }}}', |
| 170 | - 'button_text' => esc_html__( 'Add Item', 'elementor' ), | |
| 161 | + 'button_text' => 'Add Item', | |
| 171 | 162 | ] |
| 172 | 163 | ); |
| 173 | 164 | |
| 174 | 165 | $this->add_responsive_control( |
| @@ -325,9 +316,9 @@ | ||
| 325 | 316 | 'faq_schema_message', |
| 326 | 317 | [ |
| 327 | 318 | 'type' => Controls_Manager::ALERT, |
| 328 | 319 | 'alert_type' => 'info', |
| 329 | - 'content' => esc_html__( 'Google no longer supports the FAQ schema; however, it may still hold secondary value for AI and LLMs.', 'elementor' ), | |
| 320 | + 'content' => esc_html__( 'Let Google know that this section contains an FAQ. Make sure to only use it only once per page', 'elementor' ), | |
| 330 | 321 | 'condition' => [ |
| 331 | 322 | 'faq_schema[value]' => 'yes', |
| 332 | 323 | ], |
| 333 | 324 | ] |
| @@ -705,8 +696,13 @@ | ||
| 705 | 696 | Group_Control_Text_Shadow::get_type(), |
| 706 | 697 | [ |
| 707 | 698 | 'name' => $context . '_' . $state . '_text_shadow', |
| 708 | 699 | 'selector' => '{{WRAPPER}} ' . $translated_tab_css_selector, |
| 700 | + 'fields_options' => [ | |
| 701 | + 'text_shadow_type' => [ | |
| 702 | + 'label' => esc_html__( 'Shadow', 'elementor' ), | |
| 703 | + ], | |
| 704 | + ], | |
| 709 | 705 | ] |
| 710 | 706 | ); |
| 711 | 707 | |
| 712 | 708 | $this->add_group_control( |
| @@ -772,9 +768,9 @@ | ||
| 772 | 768 | |
| 773 | 769 | $this->end_controls_tab(); |
| 774 | 770 | } |
| 775 | 771 | |
| 776 | - private function is_active_icon_exist( $settings ): bool { | |
| 772 | + private function is_active_icon_exist( $settings ):bool { | |
| 777 | 773 | return array_key_exists( 'accordion_item_title_icon_active', $settings ) && ! empty( $settings['accordion_item_title_icon_active'] ) && ! empty( $settings['accordion_item_title_icon_active']['value'] ); |
| 778 | 774 | } |
| 779 | 775 | |
| 780 | 776 | private function render_accordion_icons( $settings ) { |
| @@ -909,14 +905,18 @@ | ||
| 909 | 905 | ] ); |
| 910 | 906 | } |
| 911 | 907 | |
| 912 | 908 | protected function get_initial_config(): array { |
| 913 | - return array_merge( parent::get_initial_config(), [ | |
| 914 | - 'support_improved_repeaters' => true, | |
| 915 | - 'target_container' => [ '.e-n-accordion' ], | |
| 916 | - 'node' => 'details', | |
| 917 | - 'is_interlaced' => true, | |
| 918 | - ] ); | |
| 909 | + if ( Plugin::$instance->experiments->is_feature_active( 'e_nested_atomic_repeaters' ) ) { | |
| 910 | + return array_merge( parent::get_initial_config(), [ | |
| 911 | + 'support_improved_repeaters' => true, | |
| 912 | + 'target_container' => [ '.e-n-accordion' ], | |
| 913 | + 'node' => 'details', | |
| 914 | + 'is_interlaced' => true, | |
| 915 | + ] ); | |
| 916 | + } | |
| 917 | + | |
| 918 | + return parent::get_initial_config(); | |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | protected function content_template_single_repeater_item() { |
| 922 | 922 | ?> |
| @@ -937,22 +937,13 @@ | ||
| 937 | 937 | }; |
| 938 | 938 | |
| 939 | 939 | const itemTitleTextAttributes = { |
| 940 | 940 | 'class': [ 'e-n-accordion-item-title-text' ], |
| 941 | - 'data-binding-index': view.collection.length + 1, | |
| 942 | 941 | 'data-binding-type': 'repeater-item', |
| 943 | 942 | 'data-binding-repeater-name': 'items', |
| 944 | - 'data-binding-setting': ['item_title', 'element_css_id'], | |
| 945 | - 'data-binding-config': JSON.stringify({ | |
| 946 | - 'element_css_id': { | |
| 947 | - editType: 'attribute', | |
| 948 | - attr: 'id', | |
| 949 | - selector: 'details' | |
| 950 | - }, | |
| 951 | - 'item_title': { | |
| 952 | - editType: 'text' | |
| 953 | - } | |
| 954 | - }), | |
| 943 | + 'data-binding-setting': ['item_title'], | |
| 944 | + 'data-binding-index': view.collection.length + 1, | |
| 945 | + 'data-binding-dynamic': 'true', | |
| 955 | 946 | }; |
| 956 | 947 | |
| 957 | 948 | view.addRenderAttribute( 'details-container', itemWrapperAttributes, null, true ); |
| 958 | 949 | view.addRenderAttribute( 'summary-container', itemTitleAttributes, null, true ); |
| @@ -1020,22 +1011,13 @@ | ||
| 1020 | 1011 | }); |
| 1021 | 1012 | |
| 1022 | 1013 | view.addRenderAttribute( itemTitleTextKey, { |
| 1023 | 1014 | 'class': ['e-n-accordion-item-title-text'], |
| 1024 | - 'data-binding-index': itemCount, | |
| 1025 | 1015 | 'data-binding-type': 'repeater-item', |
| 1026 | 1016 | 'data-binding-repeater-name': 'items', |
| 1027 | - 'data-binding-setting': ['item_title', 'element_css_id'], | |
| 1028 | - 'data-binding-config': JSON.stringify({ | |
| 1029 | - 'element_css_id': { | |
| 1030 | - editType: 'attribute', | |
| 1031 | - attr: 'id', | |
| 1032 | - selector: 'details' | |
| 1033 | - }, | |
| 1034 | - 'item_title': { | |
| 1035 | - editType: 'text' | |
| 1036 | - } | |
| 1037 | - }), | |
| 1017 | + 'data-binding-setting': ['item_title'], | |
| 1018 | + 'data-binding-index': itemCount, | |
| 1019 | + 'data-binding-dynamic': 'true', | |
| 1038 | 1020 | }); |
| 1039 | 1021 | #> |
| 1040 | 1022 | |
| 1041 | 1023 | <details {{{ view.getRenderAttributeString( itemWrapperKey ) }}}> |