From: soufiane Date: Mon, 23 Sep 2024 16:08:38 +0000 (+0200) Subject: wait #7096 @2:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8a71e025d35dfd096401dbd4e489a60eb00e9e8a;p=c6-wordpress.git wait #7096 @2:00 --- diff --git a/wp-content/mu-plugins/cube/src/Elementor/Setup.php b/wp-content/mu-plugins/cube/src/Elementor/Setup.php index 6e3197c..ec8c658 100644 --- a/wp-content/mu-plugins/cube/src/Elementor/Setup.php +++ b/wp-content/mu-plugins/cube/src/Elementor/Setup.php @@ -37,6 +37,7 @@ class Setup { $elementor->widgets_manager->register_widget_type( new Widgets\Heading() ); $elementor->widgets_manager->register_widget_type( new Widgets\Timeline() ); $elementor->widgets_manager->register_widget_type( new Widgets\FeatureBlock() ); + $elementor->widgets_manager->register_widget_type( new Widgets\PostsBlock() ); } protected function _customise_sections() { diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/FeatureBlock.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/FeatureBlock.php index e9afffc..c4f116e 100644 --- a/wp-content/mu-plugins/cube/src/Elementor/Widgets/FeatureBlock.php +++ b/wp-content/mu-plugins/cube/src/Elementor/Widgets/FeatureBlock.php @@ -129,17 +129,6 @@ class FeatureBlock extends Widget_Base ] ); - $this->add_control( - 'circle', - [ - 'label' => __('Circular Background', 'cube'), - 'type' => Controls_Manager::SWITCHER, - 'default' => '', - 'return_value' => 'circle', - 'prefix_class' => 'feature-block-' - ] - ); - $this->end_controls_section(); } diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/PostsBlock.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/PostsBlock.php new file mode 100644 index 0000000..80acdbb --- /dev/null +++ b/wp-content/mu-plugins/cube/src/Elementor/Widgets/PostsBlock.php @@ -0,0 +1,126 @@ +start_controls_section( + 'section_content', + [ + 'label' => __( 'Content', 'cube' ), + ] + ); + + // all the items with REPEATER + $this->add_control( + 'items', + [ + 'label' => __('Items', 'cube'), + 'type' => Controls_Manager::REPEATER, + 'fields' => [ + [ + 'name' => 'image', + 'label' => __('Image', 'cube'), + 'type' => Controls_Manager::MEDIA, + 'default' => [ + 'url' => Utils::get_placeholder_image_src(), + ], + ], + [ + 'name' => 'title', + 'label' => __('Title', 'cube'), + 'type' => Controls_Manager::TEXT, + 'label_block' => true, + 'default' => '', + ], + [ + 'name' => 'body', + 'label' => __('Description', 'cube'), + 'type' => Controls_Manager::WYSIWYG, + 'default' => '', + ], + + ], + 'title_field' => '{{{ title }}}', + ] + ); + + $this->end_controls_section(); + } + /** + * Render the widget output on the frontend. + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + + protected function render() { + $items = $this->get_settings('items'); + + $res = "
"; + foreach($items as $item) { + $res .= "
"; + $res .= "
"; + if (!empty($item['image']['id'])) { + $res .= wp_get_attachment_image($item['image']['id'], 'large', false, ['class' => 'feature-block-image']); + } + $res .= "
"; + $res .= "
"; + $res .= "

".$item['title']."

"; + $res .= "

".$item['body']."

"; + $res .= "
"; + $res .= "
"; + } + $res .= "
"; + + echo $res; + } +} diff --git a/wp-content/themes/c6/resources/assets/styles/components/headings.styl b/wp-content/themes/c6/resources/assets/styles/components/headings.styl index fed2412..f153082 100644 --- a/wp-content/themes/c6/resources/assets/styles/components/headings.styl +++ b/wp-content/themes/c6/resources/assets/styles/components/headings.styl @@ -30,3 +30,7 @@ h4 +below(600px) white-space: normal font-size: 30px + +.elementor-element.no-left + .heading-subtitle-wrapper + left: 0 diff --git a/wp-content/themes/c6/resources/assets/styles/widgets/posts-block.styl b/wp-content/themes/c6/resources/assets/styles/widgets/posts-block.styl new file mode 100644 index 0000000..ef6d8f8 --- /dev/null +++ b/wp-content/themes/c6/resources/assets/styles/widgets/posts-block.styl @@ -0,0 +1,18 @@ +.posts-block + display: flex; + gap: 43px; + + +below(1200px) + margin-top: 50px + + +below(768px) + flex-direction: column + + img + width: 100% + + &-item + flex: 1 + + &-title + font-size: 1.5rem diff --git a/wp-content/themes/c6/resources/views/widgets/posts-block.blade.php b/wp-content/themes/c6/resources/views/widgets/posts-block.blade.php new file mode 100644 index 0000000..8b48c16 --- /dev/null +++ b/wp-content/themes/c6/resources/views/widgets/posts-block.blade.php @@ -0,0 +1,13 @@ +
+ @foreach($items as $item) +
+
+ @image($item['image']['id'], 'full', ['class' => 'posts-block-item-image']) +
+
+

{{ $item['title'] }}

+

{!! $item['content'] !!}

+
+
+ @endforeach +