--- /dev/null
+<?php
+
+namespace Cube\Elementor\Widgets;
+
+use Elementor\Widget_Base;
+use Elementor\Controls_Manager;
+use Elementor\Utils;
+use Elementor\Scheme_Color;
+
+
+/**
+ * Class Subtitle
+ * @package Cube\Elementor\Widgets
+ */
+class Timeline extends Widget_Base
+{
+
+ // Widget name / ID
+ public function get_name() {
+ return 'cube-timeline';
+ }
+
+ // Elementor widget title
+ public function get_title() {
+ return __('Timeline', 'cube');
+ }
+
+ // Elementor interface icon
+ public function get_icon() {
+ return 'eicon-date';
+ }
+
+ // Where to display the widget in the Elementor interface
+ public function get_categories() {
+ return ['theme-elements'];
+ }
+
+ /**
+ * List of scripts the widget depends on.
+ * Used to set scripts dependencies required to run the widget.
+ *
+ * @since 1.0.0
+ * @access public
+ * @return array Widget scripts dependencies.
+ */
+ public function get_script_depends() {
+ return [];
+ }
+
+ /**
+ * Register the widget controls.
+ * Adds different input fields to allow the user to change and customize the widget settings.
+ *
+ * @since 1.0.0
+ * @access protected
+ */
+ protected function _register_controls() {
+
+ $this->start_controls_section(
+ 'section_content',
+ [
+ 'label' => __('Content', 'cube'),
+ ]
+ );
+
+ // items with repeater
+// $this->add_control(
+// 'items',
+// [
+// 'label' => __('Items', 'cube'),
+// 'type' => Controls_Manager::REPEATER,
+// 'fields' => [
+// [
+// 'name' => 'title',
+// 'label' => __('Title', 'elementor'),
+// 'type' => Controls_Manager::TEXTAREA,
+// 'placeholder' => __('Enter your title', 'elementor'),
+// 'default' => '',
+// ],
+// [
+// 'name' => 'subtitle',
+// 'label' => __('Subtitle', 'cube'),
+// 'type' => Controls_Manager::TEXT,
+// 'default' => '',
+// ],
+// [
+// 'name' => 'image',
+// 'label' => __( 'Image', 'elementor' ),
+// 'type' => Controls_Manager::MEDIA,
+// 'default' => [
+// 'url' => Utils::get_placeholder_image_src(),
+// ],
+// ],
+// [
+// 'name' => 'body',
+// 'label' => __('Body', 'cube'),
+// 'type' => Controls_Manager::WYSIWYG,
+// 'default' => '',
+// ],
+// 'title_field' => '{{{ title }}}',
+// ],
+//
+// ]
+// );
+
+ $this->add_control(
+ 'items',
+ [
+ 'label' => __( 'Items', 'cube' ),
+ 'type' => Controls_Manager::REPEATER,
+ 'fields' => [
+
+ [
+ 'name' => 'title',
+ 'label' => __( 'Title', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ],
+ [
+ 'name' => 'subtitle',
+ 'label' => __( 'subtitle', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ],
+ [
+ 'name' => 'image',
+ 'label' => __('Image', 'cube'),
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ],
+ [
+ '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() {
+
+// $subtitle = $this->get_settings('subtitle');
+// $title = $this->get_settings('title');
+//
+// $body = $this->parse_text_editor($this->get_settings('body'));
+// // Inline Editing settings
+// $this->add_inline_editing_attributes('subtitle', 'none');
+// $this->add_inline_editing_attributes('title', 'none');
+//
+// $this->add_inline_editing_attributes('body', 'advanced');
+//
+// // CSS Classes for elements
+// $this->add_render_attribute('subtitle', 'class', ['timeline-item-subtitle']);
+// $this->add_render_attribute('title', 'class', ['timeline-item-title']);
+// $this->add_render_attribute('body', 'class', ['timeline-item-body']);
+//
+// $settings = $this->get_settings_for_display();
+
+ // Rendered content
+ $res = '<div class="timeline">';
+
+ $items = $this->get_settings('items');
+
+ foreach ($items as $item) {
+
+ $res .= '<div class="timeline-item">';
+ $res .= '<h2 class="timeline-item-title">'. $item['title'] .'</h2>';
+ $res .= '<h3 class="timeline-item-subtitle">'. $item['subtitle'] .'</h3>';
+ $res .= wp_get_attachment_image($item['image']['id'], 'large', false, ['class' => 'timeline-item-img']);
+ $res .= '<div class="timeline-item-body">'.$item['body'].'</div>';
+ $res .= '</div>'; // .timeline-item
+
+ }
+
+ $res .= '</div>'; // .timeline
+ echo $res;
+// if (!empty($title)) {
+// echo "<h2 {$this->get_render_attribute_string('title')}>$title</h2>";
+// }
+//
+// if (!empty($subtitle)) {
+// echo "<h3 {$this->get_render_attribute_string('subtitle')}>$subtitle</h3>";
+// }
+//
+// // Get image by id
+// echo wp_get_attachment_image( $settings['image']['id'], 'large' );
+//
+// if (!empty($body)) echo "<div {$this->get_render_attribute_string('body')}>$body</div>";
+
+
+}
+
+
+}