]> _ Git - ccv-wordpress.git/commitdiff
WIP #3890 @0.5
authorStephen Cameron <stephen@cubedesigners.com>
Tue, 15 Sep 2020 14:31:05 +0000 (16:31 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Tue, 15 Sep 2020 14:31:05 +0000 (16:31 +0200)
wp-content/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php

index f74ee708d857680ecdcb57a748d9ae1106ef5faa..03760acc3192e7841666f38b9293bf61f0ed8790 100644 (file)
@@ -58,6 +58,20 @@ class TextBlock extends _Base {
                        ]
         );
 
+        $this->add_control(
+                       'title_tag',
+                       [
+                               'label' => __( 'Balise de titre (SEO)', 'cube' ),
+                'type' => Controls_Manager::SELECT,
+                'options' => [
+                    'h1' => __( 'H1', 'cube' ),
+                    'h2' => __( 'H2 (Défaut)', 'cube' ),
+                    'h3' => __( 'H3', 'cube' ),
+                ],
+                'default' => 'h2',
+                       ]
+        );
+
         $this->add_control(
                        'body',
                        [
@@ -237,6 +251,7 @@ class TextBlock extends _Base {
     protected function render() {
 
         $title = $this->get_settings('title');
+        $title_tag = $this->get_settings('title_tag');
         $title_size = $this->get_settings('title_size');
         $body = $this->parse_text_editor($this->get_settings('body'));
         $cta_text = $this->get_settings('cta_text');
@@ -270,7 +285,7 @@ class TextBlock extends _Base {
 
         // Rendered content
         echo '<div class="text-block">';
-        if (!empty($title)) echo "<h2 {$this->get_render_attribute_string('title')}>$title</h2>";
+        if (!empty($title)) echo "<{$title_tag} {$this->get_render_attribute_string('title')}>$title</{$title_tag}>";
         if (!empty($body)) echo "<div {$this->get_render_attribute_string('body')}>$body</div>";
         if (!empty($cta_text)) {
             echo '<a '. $this->get_render_attribute_string('cta_text') .'>';
@@ -306,7 +321,7 @@ class TextBlock extends _Base {
         <div class="text-block">
 
             <# if ('' !== settings.title) { #>
-                <h2 {{{ view.getRenderAttributeString( 'title' ) }}}>{{{ settings.title }}}</h2>
+                <{{{ settings.title_tag }}} {{{ view.getRenderAttributeString( 'title' ) }}}>{{{ settings.title }}}</{{{ settings.title_tag }}}>
             <# } #>
 
             <# if ('' !== settings.body) { #>