$elementor = Plugin::$instance;
+ $elementor->widgets_manager->register_widget_type( new Widgets\Template() );
$elementor->widgets_manager->register_widget_type( new Widgets\TextBlock() );
$elementor->widgets_manager->register_widget_type( new Widgets\BackgroundImage() );
$elementor->widgets_manager->register_widget_type( new Widgets\HeaderSlideshow() );
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_image',
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
+use Elementor\Repeater;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'cells',
+ [
+ 'label' => __( 'Cellules du tableau (une valeur par ligne)', 'cube' ),
+ 'placeholder' => __("Valeur 1\nValeur 2\nValeur 3\n...", 'cube'),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'default' => '',
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'bg_color',
+ [
+ 'label' => __( 'Couleur de fond', 'cube' ),
+ 'type' => Controls_Manager::SELECT,
+ 'options' => [
+ '' => __( 'Défaut', 'cube' ),
+ 'bg-white' => __( 'Blanc', 'cube' ),
+ 'bg-light' => __( 'Gris clair', 'cube' ),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'font_style',
+ [
+ 'label' => __( 'Style de police', 'cube' ),
+ 'type' => Controls_Manager::SELECT,
+ 'options' => [
+ '' => __( 'Défaut', 'cube' ),
+ 'font-bold' => __( 'Gras', 'cube' ),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'text_align',
+ [
+ 'label' => __( 'Alignement du texte', 'cube' ),
+ 'type' => Controls_Manager::SELECT,
+ 'options' => [
+ '' => __( 'Défaut', 'cube' ),
+ 'text-left' => __( 'Gauche', 'cube' ),
+ 'text-center' => __( 'Centré', 'cube' ),
+ 'text-right' => __( 'Droit', 'cube' ),
+ ],
+ ]
+ );
+
$this->add_control(
'rows',
[
'label' => __( 'Lignes du tableau', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'cells',
- 'label' => __( 'Cellules du tableau (une valeur par ligne)', 'cube' ),
- 'placeholder' => __("Valeur 1\nValeur 2\nValeur 3\n...", 'cube'),
- 'type' => Controls_Manager::TEXTAREA,
- 'default' => '',
- 'label_block' => true,
- ],
- [
- 'name' => 'bg_color',
- 'label' => __( 'Couleur de fond', 'cube' ),
- 'type' => Controls_Manager::SELECT,
- 'options' => [
- '' => __( 'Défaut', 'cube' ),
- 'bg-white' => __( 'Blanc', 'cube' ),
- 'bg-light' => __( 'Gris clair', 'cube' ),
- ],
- ],
- [
- 'name' => 'font_style',
- 'label' => __( 'Style de police', 'cube' ),
- 'type' => Controls_Manager::SELECT,
- 'options' => [
- '' => __( 'Défaut', 'cube' ),
- 'font-bold' => __( 'Gras', 'cube' ),
- ],
- ],
- [
- 'name' => 'text_align',
- 'label' => __( 'Alignement du texte', 'cube' ),
- 'type' => Controls_Manager::SELECT,
- 'options' => [
- '' => __( 'Défaut', 'cube' ),
- 'text-left' => __( 'Gauche', 'cube' ),
- 'text-center' => __( 'Centré', 'cube' ),
- 'text-right' => __( 'Droit', 'cube' ),
- ],
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ cells }}}',
]
);
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Core\Schemes;
+use Elementor\Repeater;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'content',
+ [
+ 'default' => '',
+ 'label' => __( 'Contenus', 'cube' ),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'label_block' => true,
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Éléments', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'content',
- 'default' => '',
- 'label' => __( 'Contenus', 'cube' ),
- 'type' => Controls_Manager::WYSIWYG,
- 'label_block' => true,
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ content }}}',
]
);
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$form_base = new BaseForm();
$forms = $form_base->get_forms();
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
+use Elementor\Repeater;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Titre', 'cube' ),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'default' => '',
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'value',
+ [
+ 'label' => __( 'Valeur', 'cube' ),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'default' => '',
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'bg_color',
+ [
+ 'label' => __( 'Couleur de fond', 'cube' ),
+ 'type' => Controls_Manager::SELECT,
+ 'options' => [
+ '' => __( 'Défaut', 'cube' ),
+ 'bg-white' => __( 'Blanc', 'cube' ),
+ 'bg-light' => __( 'Gris clair', 'cube' ),
+ ],
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Éléments', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'title',
- 'label' => __( 'Titre', 'cube' ),
- 'type' => Controls_Manager::WYSIWYG,
- 'default' => '',
- 'label_block' => true,
- ],
- [
- 'name' => 'value',
- 'label' => __( 'Valeur', 'cube' ),
- 'type' => Controls_Manager::WYSIWYG,
- 'default' => '',
- 'label_block' => true,
- ],
- [
- 'name' => 'bg_color',
- 'label' => __( 'Couleur de fond', 'cube' ),
- 'type' => Controls_Manager::SELECT,
- 'options' => [
- '' => __( 'Défaut', 'cube' ),
- 'bg-white' => __( 'Blanc', 'cube' ),
- 'bg-light' => __( 'Gris clair', 'cube' ),
- ],
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
namespace Cube\Elementor\Widgets;
use Elementor\Controls_Manager;
+use Elementor\Repeater;
use Elementor\Utils;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Title', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'link',
+ [
+ 'label' => __( 'Link URL', 'cube' ),
+ 'type' => Controls_Manager::URL,
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Image', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
$this->add_control(
'links',
[
'label' => __( 'Links', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'title',
- 'label' => __( 'Title', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'url',
- 'label' => __( 'Link URL', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- ],
- [
- 'name' => 'image',
- 'label' => __('Image', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
*/
protected function render() {
$links = $this->get_settings('links');
+
+ // Previously, the links repeater had a field named 'url' that was a plain text field.
+ // Elementor now offers a better field type (URL) but it's not compatible with the plain text field structure.
+ // To avoid losing data, the field was renamed to 'link' and we will merge the data here for outdated elements.
+ foreach ($links as $index => $link) {
+ if (empty($link['link']['url']) && isset($link['url'])) {
+ $links[$index]['link']['url'] = $link['url'];
+ }
+ }
+
echo view('widgets/link-carousel', compact('links'));
}
}
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
use Elementor\Controls_Manager;
use Elementor\Utils;
+use Elementor\Repeater;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'photo',
+ [
+ 'label' => __('Photo', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'name',
+ [
+ 'label' => __( 'Nom', 'cube' ),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'details',
+ [
+ 'label' => __( 'Détails', 'cube' ),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
$this->add_control(
'people',
[
'label' => __( 'People', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'photo',
- 'label' => __('Photo', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ],
- [
- 'name' => 'name',
- 'label' => __( 'Nom', 'cube' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'details',
- 'label' => __( 'Détails', 'cube' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- 'default' => '',
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ name }}}',
]
);
use Elementor\Controls_Manager;
use Elementor\Utils;
+use Elementor\Repeater;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Photo', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'caption',
+ [
+ 'label' => __( 'Caption', 'cube' ),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Photos', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'image',
- 'label' => __('Photo', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ],
- [
- 'name' => 'caption',
- 'label' => __( 'Caption', 'cube' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- 'default' => '',
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ caption }}}',
]
);
use Elementor\Controls_Manager;
use Elementor\Utils;
+use Elementor\Repeater;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Pictogramme', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Titre', 'cube' ),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'description',
+ [
+ 'label' => __( 'Description', 'cube' ),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Pictogrammes', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'image',
- 'label' => __('Pictogramme', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ],
- [
- 'name' => 'title',
- 'label' => __( 'Titre', 'cube' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'description',
- 'label' => __( 'Description', 'cube' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- 'default' => '',
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ description }}}',
]
);
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
--- /dev/null
+<?php
+
+namespace Cube\Elementor\Widgets;
+
+use Elementor\Plugin;
+use Elementor\Controls_Manager;
+use Elementor\TemplateLibrary\Source_Local;
+
+class Template extends _Base {
+
+ // Widget name / ID
+ public function get_name() {
+ return 'cube-template';
+ }
+
+ // Elementor widget title
+ public function get_title() {
+ return __( 'Shared Template', 'cube' );
+ }
+
+ // Elementor interface icon
+ public function get_icon() {
+ return 'eicon-document-file';
+ }
+
+ public function get_keywords() {
+ return [ 'elementor', 'template', 'library', 'block', 'page' ];
+ }
+
+ public function is_reload_preview_required() {
+ return false;
+ }
+
+ /**
+ * 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() {
+
+ $template_library = new Source_Local();
+ $template_collection = $template_library->get_items(['elementor_library_category' => 'global']);
+ $templates = [];
+
+ foreach($template_collection as $template) {
+ $templates[$template['template_id']] = "[{$template['type']}] {$template['title']}";
+ }
+
+ $this->start_controls_section(
+ 'section_content',
+ [
+ 'label' => __( 'Embed a Template', 'cube' ),
+ ]
+ );
+
+ $this->add_control(
+ 'description',
+ [
+ 'type' => Controls_Manager::RAW_HTML,
+ 'raw' => 'This widget allows shared content blocks to be embedded in multiple places via templates. This enables all embedded blocks to be updated centrally by editing the template. It is possible to nest templates. To appear in the list, the template must be in the "Global" category.<br><a href="/wp-admin/edit.php?post_type=elementor_library&tabs_group=library" target="_blank">Manage templates >></a>.',
+ 'content_classes' => 'elementor-descriptor',
+ ]
+ );
+
+ $this->add_control(
+ 'template_id',
+ [
+ 'type' => Controls_Manager::SELECT,
+ 'label' => __( 'Template', 'cube' ),
+ 'label_block' => true,
+ 'default' => '',
+ 'options' => ['' => __('(Sélectionner)', 'cube')] + $templates,
+ ]
+ );
+
+
+ $this->end_controls_section();
+
+ $this->common_controls();
+ }
+ /**
+ * 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() {
+ $template_id = $this->get_settings( 'template_id' );
+
+ if ( 'publish' !== get_post_status( $template_id ) ) {
+ return;
+ }
+
+ ?>
+ <div class="cube-template elementor-template">
+ <?php
+ echo Plugin::instance()->frontend->get_builder_content_for_display( $template_id );
+ ?>
+ </div>
+ <?php
+ }
+
+ public function render_plain_content() {}
+}
namespace Cube\Elementor\Widgets;
use Elementor\Controls_Manager;
+use Elementor\Repeater;
use function Roots\view;
use function Roots\asset;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'name',
+ [
+ 'label' => __( 'Name', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'testimonial',
+ [
+ 'label' => __( 'Testimonial', 'cube' ),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'notes',
+ [
+ 'label' => __( 'Notes', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ ]
+ );
+
$this->add_control(
'testimonials',
[
'label' => __( 'Testimonials', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'name',
- 'label' => __( 'Name', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'testimonial',
- 'label' => __( 'Testimonial', 'cube' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- ],
- [
- 'name' => 'notes',
- 'label' => __( 'Notes', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ name }}}',
]
);
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
use Elementor\Controls_Manager;
use Elementor\Utils;
+use Elementor\Repeater;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'highlight',
+ [
+ 'label' => __('Highlight', 'cube'),
+ 'type' => Controls_Manager::SWITCHER,
+ 'return_value' => 'yes',
+ 'default' => 'yes',
+ ]
+ );
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Image', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'year',
+ [
+ 'label' => __('Year', 'cube'),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __('Title', 'cube'),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'details',
+ [
+ 'label' => __('Description', 'cube'),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'cta_text',
+ [
+ 'label' => __('Call to Action text', 'cube'),
+ 'type' => Controls_Manager::TEXT,
+ 'default' => ''
+ ]
+ );
+
+ $repeater->add_control(
+ 'cta_link',
+ [
+ 'label' => __('Call to Action link', 'cube'),
+ 'type' => Controls_Manager::URL,
+ 'default' => [
+ 'url' => '',
+ 'is_external' => false,
+ ],
+ 'show_external' => true
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __('Items', 'cube'),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'highlight',
- 'label' => __('Highlight', 'cube'),
- 'type' => Controls_Manager::SWITCHER,
- 'return_value' => 'yes',
- 'default' => 'yes',
- ],
- [
- 'name' => 'image',
- 'label' => __('Image', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ],
- [
- 'name' => 'year',
- 'label' => __('Year', 'cube'),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'title',
- 'label' => __('Title', 'cube'),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'details',
- 'label' => __('Description', 'cube'),
- 'type' => Controls_Manager::WYSIWYG,
- 'default' => '',
- ],
- [
- 'name' => 'cta_text',
- 'label' => __('Call to Action text', 'cube'),
- 'type' => Controls_Manager::TEXT,
- 'default' => ''
- ],
- [
- 'name' => 'cta_link',
- 'label' => __('Call to Action link', 'cube'),
- 'type' => Controls_Manager::URL,
- 'default' => [
- 'url' => '',
- 'is_external' => false,
- ],
- 'show_external' => true
- ]
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ year }}} {{{ title }}}',
]
);
use Elementor\Controls_Manager;
use Elementor\Utils;
+use Elementor\Repeater;
use function Roots\asset;
use function Roots\view;
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Image', 'cube'),
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __('Title', 'cube'),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'content',
+ [
+ 'label' => __('Contenu', 'cube'),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'label_block' => true,
+ 'default' => ''
+ ]
+ );
+
$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' => 'content',
- 'label' => __('Contenu', 'cube'),
- 'type' => Controls_Manager::WYSIWYG,
- 'label_block' => true,
- 'default' => ''
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
}
}, 100);
+/**
+ * Add admin specific styles
+ */
+function add_admin_styles() {
+ if (is_admin()) {
+ wp_enqueue_style('cube/admin.css', asset('styles/admin.css')->uri(), false, null);
+ }
+}
+add_action('admin_enqueue_scripts', __NAMESPACE__ . '\add_admin_styles');
+add_action('elementor/common/after_register_scripts', __NAMESPACE__ . '\add_admin_styles');
+
/**
* Theme setup
*/
--- /dev/null
+// Admin specific styles
+
+/*! purgecss start ignore */
+
+// Position Cubedesigners custom widgets above all others in the Elementor sidebar
+#elementor-panel-categories
+ display: flex
+ flex-direction: column
+
+#elementor-panel-category-cube
+ order: -1
+
+#elementor-panel-category-pro-elements
+ order: 99 // Put these at the bottom (or could hide them completely?)
+
+// Tiny MCE editor styles in Elementor editor
+// Most styles for editor set in text-block.styl body...
+#tinymce
+ @apply font-body
+ @apply p-3 !important
+
+ // Normally the lists have no margin and the bullet > image sits
+ // in the spacing gutter created by the text-block. In the context
+ // of the editor, it would be hidden so we indent it to make it
+ // visible while editing...
+ ul
+ margin-left: 1.3em
+
+//===== Admin bar tweaks
+$breakpoint-admin-bar = 783px
+$breakpoint-admin-bar-absolute = 600px // When admin bar goes from being 'fixed' to 'absolute'
+$admin-bar-height = 32px
+$admin-bar-height-mobile = 46px
+
+//#wpadminbar
+// overflow: hidden // Can't do this because it will break dropdown menus in the admin bar
+
+#wp-toolbar
+ display: flex
+ justify-content: space-between
+
+ > *
+ display: flex
+ white-space: nowrap
+
+ // Wrap/hide extra toolbar items on the left when there's not enough space
+ #wp-admin-bar-root-default
+ flex-wrap: wrap
+
+ #wp-admin-bar-top-secondary
+ flex-shrink: 0
+
+body.admin-bar
+ +above($breakpoint-admin-bar)
+ position: relative
+
+ header.site, #mobile-menu
+ top: $admin-bar-height
+
+ .mobile-menu-trigger
+ top: 30px + $admin-bar-height
+
+ +below($breakpoint-admin-bar)
+ header.site, #mobile-menu
+ top: $admin-bar-height-mobile
+
+ .mobile-menu-trigger
+ top: 30px + $admin-bar-height-mobile
+
+ +below($breakpoint-admin-bar-absolute)
+ header.site, #mobile-menu
+ top: 0
+
+ .mobile-menu-trigger
+ top: 30px
+
+/*! purgecss end ignore */
@import 'common/mixins'
@import 'common/debug'
@import 'common/global'
-@import 'common/admin'
@import 'common/layout'
@import 'common/animations'
+++ /dev/null
-// Tiny MCE editor styles in Elementor editor
-// Most styles for editor set in text-block.styl body...
-#tinymce
- @apply font-body
- @apply p-3 !important
-
- // Normally the lists have no margin and the bullet > image sits
- // in the spacing gutter created by the text-block. In the context
- // of the editor, it would be hidden so we indent it to make it
- // visible while editing...
- ul
- margin-left: 1.3em
-
-//===== Admin bar tweaks
-$breakpoint-admin-bar = 783px
-$breakpoint-admin-bar-absolute = 600px // When admin bar goes from being 'fixed' to 'absolute'
-$admin-bar-height = 32px
-$admin-bar-height-mobile = 46px
-
-#wpadminbar
- overflow: hidden
-
-#wp-toolbar
- display: flex
- justify-content: space-between
-
- > *
- display: flex
- white-space: nowrap
-
- // Wrap/hide extra toolbar items on the left when there's not enough space
- #wp-admin-bar-root-default
- flex-wrap: wrap
-
- #wp-admin-bar-top-secondary
- flex-shrink: 0
-
-body.admin-bar
- +above($breakpoint-admin-bar)
- position: relative
-
- header.site, #mobile-menu
- top: $admin-bar-height
-
- .mobile-menu-trigger
- top: 30px + $admin-bar-height
-
- +below($breakpoint-admin-bar)
- header.site, #mobile-menu
- top: $admin-bar-height-mobile
-
- .mobile-menu-trigger
- top: 30px + $admin-bar-height-mobile
-
- +below($breakpoint-admin-bar-absolute)
- header.site, #mobile-menu
- top: 0
-
- .mobile-menu-trigger
- top: 30px
--- /dev/null
+<article @php(post_class())>
+
+ <header class="text-center mb-1v">
+ <h1 class="plain relative bg-purple py-1v px-2v text-white text-xl inline-block rounded-lg">
+ <span class="absolute top-0 left-0 w-full text-center pt-3 uppercase font-light text-xs opacity-50">Elementor Template</span>
+ <span class="block pt-4">{!! $title !!}</span>
+ <span class="font-light text-base opacity-50">ID: {{ get_post_field('post_name') }}</span>
+ </h1>
+ </header>
+
+ <div class="entry-content">
+ @php(the_content())
+ </div>
+
+</article>
<div class="nav-secondary absolute top-0 right-0 flex items-center">
- {{-- Language switcher (temporarily disabled)
+ {{-- Language switcher --}}
<ul class="locales flex mr-2">
@foreach ($languages as $lang)
<li class="mr-4">
</li>
@endforeach
</ul>
- --}}
@if ($button_1)
<a href="{{ $button_1->url }}"
<div class="link-carousel swiper-container" data-swiper="{{ $swiper }}">
<div class="swiper-wrapper">
@foreach ($links as $link)
- <a class="link-carousel-item swiper-slide" href="{{ $link['url'] }}">
+ <a class="link-carousel-item swiper-slide" href="{{ $link['link']['url'] }}">
<div class="link-carousel-item-image">
<img src="{{ $link['image']['url'] }}" alt="{{ $link['title'] }}">
</div>
$target = $item['cta_link']['is_external'] ? ' target="_blank"' : '';
$rel = $item['cta_link']['nofollow'] ? ' rel="nofollow"' : '';
@endphp
- <a class="btn px-4 py-2 -mt-2" href="{{ $item['cta_link']['url'] }}"{!! $target !!}{!! $rel !!}>
+ <br>
+ <a class="btn px-4 py-2 mt-2" href="{{ $item['cta_link']['url'] }}"{!! $target !!}{!! $rel !!}>
{{ $item['cta_text'] }}
</a>
@endif
// Main Styles
mix.stylus(src`styles/app.styl`, 'styles', stylusConfig).options(stylusOptions).tailwind();
+// Admin Styles
+mix.stylus(src`styles/admin.styl`, 'styles', stylusConfig).options(stylusOptions).tailwind();
+
// Assets
mix.copyDirectory(src`images`, publicPath`images`)
.copyDirectory(src`fonts`, publicPath`fonts`);