diff --git a/bricks.xml b/bricks.xml index b66357261c56f685afcc5941e0e8e14f86ef123b..857184f6dd9058c4e4a88f40136c9adf30415442 100644 --- a/bricks.xml +++ b/bricks.xml @@ -16,6 +16,13 @@ <locale group="quiqqer/timeline" var="brick.timeline.setting.site"/> </setting> + <setting name="site" type="number"> + <locale group="quiqqer/timeline" var="brick.timeline.setting.site"/> + <description> + <locale group="quiqqer/timeline" var="brick.timeline.setting.site"/> + </description> + </setting> + <setting name="imageFillMode" type="select"> <locale group="quiqqer/timeline" var="brick.timeline.setting.imageFillMode"/> diff --git a/locale.xml b/locale.xml index efe4e9cee88b82bb3176124569bbac4470286dbb..33f6e7f9fd92a4966ebd2dcf84ce553b494fabcd 100644 --- a/locale.xml +++ b/locale.xml @@ -68,12 +68,12 @@ <locale name="brick.timeline.setting.limit"> - <de><![CDATA[Maximale Anzahl]]></de> + <de><![CDATA[Limit]]></de> <en><![CDATA[Limit]]></en> </locale> <locale name="brick.timeline.setting.limit.desc"> - <de><![CDATA[Legt die maximale Anzahl der Einträge fest.]]></de> - <en><![CDATA[Sets the maximum number of items to display.]]></en> + <de><![CDATA[Mit dieser Einstellung kann die Anzahl der angezeigten Einträge begrenzt werden. Um alle Einträge anzuzeigen, muss das Feld leer bleiben.]]></de> + <en><![CDATA[This setting allows you to limit the number of displayed entries. To show all entries, please leave the field empty.]]></en> </locale> </groups> @@ -85,6 +85,15 @@ <en><![CDATA[Timeline: settings]]></en> </locale> + <locale name="timeline.limit"> + <de><![CDATA[Limit]]></de> + <en><![CDATA[Limit]]></en> + </locale> + <locale name="timeline.limit.desc"> + <de><![CDATA[Mit dieser Einstellung kann die Anzahl der angezeigten Einträge begrenzt werden. Um alle Einträge anzuzeigen, muss das Feld leer bleiben.]]></de> + <en><![CDATA[This setting allows you to limit the number of displayed entries. To show all entries, please leave the field empty.]]></en> + </locale> + <!-- template / display --> <locale name="timeline.display"> <de><![CDATA[Vorlage]]></de> diff --git a/site.xml b/site.xml index 480c246795883c635b8a185170df6b363a8099fd..257db45b86601d73588de1519c4228f6d6d32b0b 100644 --- a/site.xml +++ b/site.xml @@ -11,6 +11,7 @@ <!-- list attributes --> <attributes> + <attribute>quiqqer.timeline.limit</attribute> <attribute default="VerticalBothSides">quiqqer.timeline.display</attribute> <attribute default="0">quiqqer.timeline.showLinks</attribute> <attribute default="cover">quiqqer.timeline.imageFillMode</attribute> @@ -25,6 +26,20 @@ var="timeline.settings.title"/> </title> + <input conf="quiqqer.timeline.limit" type="number"> + <text> + <locale group="quiqqer/timeline" + var="timeline.limit" + /> + </text> + + <description> + <locale group="quiqqer/timeline" + var="timeline.limit.desc" + /> + </description> + </input> + <select conf="quiqqer.timeline.display"> <text> <locale group="quiqqer/timeline" diff --git a/src/QUI/Timeline/Bricks/Timeline.php b/src/QUI/Timeline/Bricks/Timeline.php index b9d053c880f5a27c259c9698869f901bb6a89951..ab291232d632b843001411c76fc82b5c8bfbede7 100644 --- a/src/QUI/Timeline/Bricks/Timeline.php +++ b/src/QUI/Timeline/Bricks/Timeline.php @@ -28,7 +28,7 @@ public function __construct($attributes = []) 'order' => 'c_date ASC', 'showLinks' => true, 'template' => 'VerticalBothSides', - 'limit' => 10 + 'limit' => false ]); parent::__construct($attributes); @@ -47,10 +47,10 @@ public function getBody(): string $Engine = QUI::getTemplateManager()->getEngine(); $Control = new QUI\Timeline\Controls\Timeline(); - $limit = $this->getAttribute('limit'); + $limit = false; - if (!$limit || $limit < 1) { - $limit = 10; + if ($this->getAttribute('limit') >= 1) { + $limit = $this->getAttribute('limit'); } $attributes = [ diff --git a/src/QUI/Timeline/Controls/Timeline.php b/src/QUI/Timeline/Controls/Timeline.php index 226d0796981a6a568c2676a9e7e1158ea36dee7c..840fdf743d89631c7be2f14afafdca9af833936c 100644 --- a/src/QUI/Timeline/Controls/Timeline.php +++ b/src/QUI/Timeline/Controls/Timeline.php @@ -32,7 +32,7 @@ public function __construct(array $attributes = []) 'parentInputList' => false, //todo später für brick 'showLinks' => true, 'display' => 'VerticalBothSides', - 'limit' => 10, + 'limit' => false, 'imageFillMode' => 'cover', // cover / contain // Custom children template (path to html file); overwrites "display" 'displayTemplate' => false, @@ -62,7 +62,12 @@ public function getBody(): string return ''; } - $limit = $this->getAttribute('limit') ?: 10; + $limit = false; + + if ($this->getAttribute('limit') >= 1) { + $limit = $this->getAttribute('limit'); + } + $parents = $this->getAttribute('parentInputList') ?: $Site->getId(); // only active sites diff --git a/types/timeline.php b/types/timeline.php index 002c452affa30a5eddb1aada7814255eb8ecfef0..f0b74dacbc33613ae1d6de7d6c61952967ca3b70 100644 --- a/types/timeline.php +++ b/types/timeline.php @@ -9,7 +9,8 @@ 'showLinks' => $Site->getAttribute('quiqqer.timeline.showLinks'), 'itemtype' => 'http://schema.org/ItemList', 'child-itemtype' => 'http://schema.org/ListItem', - 'display' => $Site->getAttribute('quiqqer.timeline.display') + 'display' => $Site->getAttribute('quiqqer.timeline.display'), + 'limit' => $Site->getAttribute('quiqqer.timeline.limit') ]); $Engine->assign([