From 47a88bcd05f0e69d0db77b1583bb2864bbf7ba88 Mon Sep 17 00:00:00 2001 From: Campii <dominik.chrzanowski183@gmail.com> Date: Wed, 16 Mar 2022 18:20:49 +0100 Subject: [PATCH] feat: Added new settings (template, limit) [Timeline] quiqqer/timeline#1 --- bricks.xml | 15 +++++++++++++++ locale.xml | 15 +++++++++++++++ src/QUI/Timeline/Bricks/Timeline.php | 20 +++++++++++++++++--- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/bricks.xml b/bricks.xml index 4623ee8..7db7645 100644 --- a/bricks.xml +++ b/bricks.xml @@ -47,6 +47,21 @@ <setting name="showLinks" type="checkbox"> <locale group="quiqqer/timeline" var="brick.timeline.setting.showLinks"/> </setting> + + <setting name="template" type="select"> + <locale group="quiqqer/timeline" + var="brick.timeline.setting.order"/> + + <option value="VerticalBothSides"> + <locale group="quiqqer/timeline" + var="brick.timeline.setting.template.verticalBothSides"/> + </option> + </setting> + + <setting name="limit" type="number"> + <locale group="quiqqer/timeline" + var="brick.timeline.setting.limit"/> + </setting> </settings> </brick> diff --git a/locale.xml b/locale.xml index 310e2f1..00967f5 100644 --- a/locale.xml +++ b/locale.xml @@ -85,6 +85,21 @@ <en><![CDATA[Show hyperlinks for each site?]]></en> </locale> + <locale name="brick.timeline.setting.template"> + <de><![CDATA[Vorlage]]></de> + <en><![CDATA[Template]]></en> + </locale> + + <locale name="brick.timeline.setting.template.verticalBothSides"> + <de><![CDATA[Vertikale Zeitleiste mit Inhalt und Symbol (Bild)]]></de> + <en><![CDATA[Vertical timeline wiht content and icon (image)]]></en> + </locale> + + <locale name="brick.timeline.setting.limit"> + <de><![CDATA[Limit (Grundlimit 10)]]></de> + <en><![CDATA[Limit (basic limit it 10)]]></en> + </locale> + </groups> <groups name="quiqqer/timeline" datatype="php"> diff --git a/src/QUI/Timeline/Bricks/Timeline.php b/src/QUI/Timeline/Bricks/Timeline.php index f19e9a4..5695115 100644 --- a/src/QUI/Timeline/Bricks/Timeline.php +++ b/src/QUI/Timeline/Bricks/Timeline.php @@ -25,8 +25,11 @@ public function __construct($attributes = []) { // default options $this->setAttributes([ - 'image' => 'original', // original, cover - 'order' => 'c_date ASC', + 'image' => 'original', // original, cover + 'order' => 'c_date ASC', + 'showLinks' => true, + 'template' => 'VerticalBothSides', + 'limit' => 10 ]); parent::__construct($attributes); @@ -45,11 +48,22 @@ public function getBody() $Engine = QUI::getTemplateManager()->getEngine(); $Control = new QUI\Timeline\Controls\Timeline(); + $limit = $this->getAttribute('limit'); + + if ($limit === '') { + $limit = 10; + } + + if ($limit <= 0) { + $limit = 1; + } + $Control->setAttribute('parentInputList', $this->getAttribute('site')); $Control->setAttribute('imageFit', $this->getAttribute('image')); $Control->setAttribute('order', $this->getAttribute('order')); $Control->setAttribute('showLinks', $this->getAttribute('showLinks')); - + $Control->setAttribute('display', $this->getAttribute('template')); + $Control->setAttribute('limit', $limit); $result = $Control->create(); $this->addCSSFiles($Control->getCSSFiles()); -- GitLab