← All changes
|
modules/atomic-widgets/elements/atomic-heading/atomic-heading.php
+4
-37
4.2.2
→
3.35.7
View file →
| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base; |
| 10 | 10 | use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template; |
| 11 | 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 12 | 12 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 13 | -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type; | |
| 13 | +use Elementor\Modules\AtomicWidgets\PropTypes\Html_Prop_Type; | |
| 14 | 14 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 15 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| 16 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 17 | 17 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| @@ -54,15 +54,11 @@ | ||
| 54 | 54 | ->enum( [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ] ) |
| 55 | 55 | ->default( 'h2' ) |
| 56 | 56 | ->description( 'The HTML tag for the heading element. Could be h1, h2, up to h6' ), |
| 57 | 57 | |
| 58 | - 'title' => Html_V3_Prop_Type::make() | |
| 59 | - ->default( [ | |
| 60 | - 'content' => String_Prop_Type::generate( __( 'This is a title', 'elementor' ) ), | |
| 61 | - 'children' => [], | |
| 62 | - ] ) | |
| 63 | - ->description( 'The text content of the heading.' ) | |
| 64 | - ->alias( 'text', 'content', 'heading' ), | |
| 58 | + 'title' => Html_Prop_Type::make() | |
| 59 | + ->default( __( 'This is a title', 'elementor' ) ) | |
| 60 | + ->description( 'The text content of the heading.' ), | |
| 65 | 61 | |
| 66 | 62 | 'link' => Link_Prop_Type::make(), |
| 67 | 63 | |
| 68 | 64 | 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), |
| @@ -71,9 +67,8 @@ | ||
| 71 | 67 | |
| 72 | 68 | protected function define_atomic_controls(): array { |
| 73 | 69 | $content_section = Section::make() |
| 74 | 70 | ->set_label( __( 'Content', 'elementor' ) ) |
| 75 | - ->set_id( 'content' ) | |
| 76 | 71 | ->set_items( [ |
| 77 | 72 | Inline_Editing_Control::bind_to( 'title' ) |
| 78 | 73 | ->set_placeholder( __( 'Type your title here', 'elementor' ) ) |
| 79 | 74 | ->set_label( __( 'Title', 'elementor' ) ), |
| @@ -154,34 +149,6 @@ | ||
| 154 | 149 | protected function get_templates(): array { |
| 155 | 150 | return [ |
| 156 | 151 | 'elementor/elements/atomic-heading' => __DIR__ . '/atomic-heading.html.twig', |
| 157 | 152 | ]; |
| 158 | - } | |
| 159 | - | |
| 160 | - public function render_markdown(): string { | |
| 161 | - $settings = $this->get_atomic_settings(); | |
| 162 | - $title = wp_strip_all_tags( $settings['title'] ?? '' ); | |
| 163 | - | |
| 164 | - if ( empty( $title ) ) { | |
| 165 | - return ''; | |
| 166 | - } | |
| 167 | - | |
| 168 | - $tag = $settings['tag'] ?? 'h2'; | |
| 169 | - $level_map = [ | |
| 170 | - 'h1' => 1, | |
| 171 | - 'h2' => 2, | |
| 172 | - 'h3' => 3, | |
| 173 | - 'h4' => 4, | |
| 174 | - 'h5' => 5, | |
| 175 | - 'h6' => 6, | |
| 176 | - ]; | |
| 177 | - $level = $level_map[ $tag ] ?? 2; | |
| 178 | - | |
| 179 | - $md = str_repeat( '#', $level ) . ' ' . $title; | |
| 180 | - | |
| 181 | - if ( ! empty( $settings['link']['href'] ) ) { | |
| 182 | - $md = str_repeat( '#', $level ) . ' [' . $title . '](' . esc_url( $settings['link']['href'] ) . ')'; | |
| 183 | - } | |
| 184 | - | |
| 185 | - return $md; | |
| 186 | 153 | } |
| 187 | 154 | } |