?>
</{$html_tag[$marker_type]}>
<?php
+ echo "<button class='btn display-all-lists'>Tout afficher <span class='counter'></span></button>";
echo "</div>";
}
-
- protected function content_template() {
- ?>
- <#
- html_tag = {
- 'ordered': 'ol',
- 'unordered': 'ul',
- 'other': 'ul',
- };
- view.addRenderAttribute( 'list', 'class', 'assoc-list' );
-
- view.addRenderAttribute( 'title', 'class', ['font-bold text-lg text-center relative']);
-
- view.addInlineEditingAttributes( 'title', 'none' );
-
- #>
-
- <div class="assoc-block">
- <# if ('' !== settings.title) { #>
- <div class="text-block-title relative">
- <{{{ settings.title_tag }}} {{{ view.getRenderAttributeString( 'title' ) }}}>
- {{{ settings.title }}}
- </{{{ settings.title_tag }}}>
- <span class="design-line"></span>
- </div>
- <# } #>
- <div class="assoc-block-gallery">
- <# _.each( settings.gallery, function( image ) { #>
- <img src="{{ image.url }}">
- <# }); #>
- </div>
- <{{{ html_tag[ settings.marker_type ] }}} {{{ view.getRenderAttributeString( 'list' ) }}}>
- <# _.each( settings.list_items, function( item, index ) {
- var repeater_setting_key = view.getRepeaterSettingKey( 'text', 'list_items', index );
- view.addRenderAttribute( repeater_setting_key, 'class', 'elementor-list-widget-text' );
- view.addInlineEditingAttributes( repeater_setting_key );
- #>
- <li {{{ view.getRenderAttributeString( repeater_setting_key ) }}}>
- <# var title = item.text; #>
- <# if ( item.link ) { #>
- <# view.addRenderAttribute( `link_${index}`, item.link ); #>
- <a href="{{ item.link.url }}" {{{ view.getRenderAttributeString( `link_${index}` ) }}}>
- {{{title}}}
- </a>
- <# } else { #>
- {{{title}}}
- <# } #>
- </li>
- <# } ); #>
- </{{{ html_tag[ settings.marker_type ] }}}>
- </div>
- <?php
- }
}
\ No newline at end of file
namespace Cube\Widgets;
use Elementor\Controls_Manager;
+use Elementor\Group_Control_Image_Size;
+use Elementor\Widget_Image_Gallery;
class TextWithBtn extends _Base {
);
$this->end_controls_section();
+
+ $this->start_controls_section(
+ 'section_gallery',
+ [
+ 'label' => esc_html__( 'Image Gallery', 'elementor' ),
+ ]
+ );
+
+ $this->add_control(
+ 'wp_gallery',
+ [
+ 'label' => esc_html__( 'Add Images', 'elementor' ),
+ 'type' => Controls_Manager::GALLERY,
+ 'show_label' => false,
+ 'dynamic' => [
+ 'active' => true,
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Image_Size::get_type(),
+ [
+ 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
+ 'exclude' => [ 'custom' ],
+ 'separator' => 'none',
+ ]
+ );
+
+ $gallery_columns = range( 1, 10 );
+ $gallery_columns = array_combine( $gallery_columns, $gallery_columns );
+
+ $this->add_control(
+ 'gallery_columns',
+ [
+ 'label' => esc_html__( 'Columns', 'elementor' ),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => 4,
+ 'options' => $gallery_columns,
+ ]
+ );
+
+ $this->add_control(
+ 'gallery_position',
+ [
+ 'label' => esc_html__( 'Position', 'elementor' ),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => 'gallery-right',
+ 'options' => [
+ 'gallery-right' => 'right',
+ 'gallery-left' => 'left',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+
$this->start_controls_section(
'style_section',
[
'tab' => Controls_Manager::TAB,
]
);
+ $this->add_control(
+ 'text_color',
+ [
+ 'label' => esc_html__( 'Text Color', 'cube' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .highlight' => 'color: {{VALUE}}',
+ ],
+ ]
+ );
$this->add_control(
'color',
[
*/
protected function render() {
- $abovetitle = $this->get_settings('above_title');
- $title = $this->get_settings('title');
- $title_tag = $this->get_settings('title_tag');
- $body = $this->parse_text_editor($this->get_settings('body'));
- $cta_text = $this->get_settings('cta_text');
- $cta_link = $this->get_settings('cta_link');
$cta_class = $this->get_settings('cta_class') ? $this->get_settings('cta_class') : '';
if ( ! empty( $cta_link['url'] ) ) {
$this->add_render_attribute('body', 'class', ['text-blockbtn-body font-semibold']);
$this->add_render_attribute('cta_text', 'class', ["text-blockbtn-cta btn font-semibold $cta_class"]);
+ $settings = $this->get_settings_for_display();
+ $attributes = $this->get_render_attributes();
+
+ echo view('widgets/text-image-with-btn')->with('settings',$settings)->with('attributes',$attributes);
// Rendered content
- echo '<div class="text-blockbtn">';
- if (!empty($abovetitle)) echo "<p {$this->get_render_attribute_string('above_title')}>$abovetitle</p>";
- 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 '<div><a '. $this->get_render_attribute_string('cta_text') .'>';
- echo $cta_text;
- echo '</a></div>';
- }
- echo '</div>';
}
- /**
- * Render text editor widget output in the editor.
- *
- * Written as a Backbone JavaScript template and used to generate the live preview.
- *
- * @since 1.0.0
- * @access protected
- */
- protected function content_template() {
- ?>
- <#
- div_tag = "div";
- view.addRenderAttribute( 'above_title', 'class', ['text-block-above-title font-semibold']);
- view.addRenderAttribute( 'title', 'class', ['text-block-title font-bold text-xl']);
- view.addRenderAttribute( 'body', 'class', ['text-block-body font-semibold']);
- view.addRenderAttribute( 'cta_text', 'class', ['text-block-cta btn font-semibold']);
-
- view.addInlineEditingAttributes( 'above_title', 'none' );
- view.addInlineEditingAttributes( 'title', 'none' );
- view.addInlineEditingAttributes( 'body', 'none' );
- view.addInlineEditingAttributes( 'cta_text', 'none' );
- #>
- <{{{ div_tag }}} class="text-blockbtn">
- <# if ('' !== settings.above_title) { #>
- <p {{{ view.getRenderAttributeString( 'above_title' ) }}} >{{{ settings.above_title }}}</p>
- <# } #>
-
- <# if ('' !== settings.title) { #>
- <{{{ settings.title_tag }}} {{{ view.getRenderAttributeString( 'title' ) }}}>{{{ settings.title }}}</{{{ settings.title_tag }}}>
- <# } #>
-
- <# if ('' !== settings.body) { #>
- <div {{{ view.getRenderAttributeString( 'body' ) }}}>{{{ settings.body }}}</div>
- <# } #>
-
- <# if ('' !== settings.cta_text) { #>
- <div>
- <a {{{ view.getRenderAttributeString( 'cta_text' ) }}}>
- {{{ settings.cta_text }}}
- </a>
- </div>
- <# } #>
-
- </{{{ div_tag }}}>
- <?php
- }
}
--- /dev/null
+<div class="text-blockbtn {{ $settings['gallery_position'] }}">
+ <p class="text-blockbtn-above-title highlight relative font-semibold">
+ <span class='relative z-1'>{{ $settings['above_title'] }}</span>
+ <span class='highlight-bar'></span>
+ </p>
+ <{{$settings['title_tag']}} class="{{implode(' ',$attributes['title']['class'])}}">
+ {!! $settings['title'] !!}
+ </{{$settings['title_tag']}}>
+
+ <div class="text-blockbtn-gallery gallery-columns-{{ $settings['gallery_columns'] }}">
+ @foreach($settings['wp_gallery'] as $image)
+ <div class="gallery-item">
+ <div class="gallery-icon">
+ <img class="attachment-{{ $settings['thumbnail_size'] }} size-{{ $settings['thumbnail_size'] }}" src="{{ $image['url'] }}" />
+ </div>
+ </div>
+ @endforeach
+ </div>
+
+ <div class="{{implode(' ',$attributes['body']['class'])}}">{!! $settings['body'] !!}</div>
+ <div class="text-blockbtn-btn">
+ <a href="{{$settings['cta_link']['url']}}" class="{{implode(' ',$attributes['cta_text']['class'])}}">
+ {!! $settings['cta_text'] !!}
+ </a>
+ </div>
+</div>