diff --git a/bricks.xml b/bricks.xml index a5b41b55b4e0d49f87810e0f165c0d2207fe3593..c4bad310498278fc3ca8492bb2b1e3c8eab91c78 100644 --- a/bricks.xml +++ b/bricks.xml @@ -82,8 +82,6 @@ </brick> - - <!-- Content Switcher --> <brick control="\QUI\Bricks\Controls\ContentSwitcher"> <title> @@ -105,9 +103,25 @@ </brick> + <!-- Image Brick --> + <brick control="\QUI\Bricks\Controls\Image"> + <title> + <locale group="quiqqer/bricks" var="bricks.Image.title"/> + </title> + <description> + <locale group="quiqqer/bricks" var="bricks.Image.description"/> + </description> + <settings> + <setting name="link" class="project-site"> + <locale group="quiqqer/bricks" var="Image.link"/> + </setting> - + <setting name="picture" class="media-image"> + <locale group="quiqqer/bricks" var="Image.picture"/> + </setting> + </settings> + </brick> @@ -129,7 +143,7 @@ </settings> </brick> - /* Maps */ + <!-- Maps --> <brick control="\QUI\Bricks\Controls\GoogleMaps"> <title> diff --git a/lib/QUI/Bricks/Controls/ContentSwitcher.html b/lib/QUI/Bricks/Controls/ContentSwitcher.html index d7a08a395a0eff125a609484f333acc8053933b2..08b6e0f06ae6e5007c47ff943631598204733144 100644 --- a/lib/QUI/Bricks/Controls/ContentSwitcher.html +++ b/lib/QUI/Bricks/Controls/ContentSwitcher.html @@ -2,16 +2,13 @@ {foreach from=$entries item=entry key=key} {assign var=img value=$entry.img} - <!-- display on desktops, replace text and image position by adding a new entry --> -<div class="content-switcher hide-on-mobile"> +<section class="content-switcher hide-on-mobile"> {assign var=modKey value=$key+1} {if $modKey && $modKey % 2 !== 0 } <div class="content-switcher-image"> {if $img != ""} - <img width=300 height=auto src="{$entry.img}"/> - {else} - <img style="display: none;"> + {image src=$entry.img width=300} {/if} </div> <div class="content-switcher-content"> @@ -26,27 +23,23 @@ <div class="content-switcher-image"> {if $img != ""} - <img width=300 height=auto src="{$entry.img}"/> - {else} - <img style="display: none;"> + {image src=$entry.img width=300} {/if} </div> {/if} -</div> +</section> <!-- for small screens: image always comes above the text --> -<div class="content-switcher hide-on-desktop"> +<section class="content-switcher hide-on-desktop"> <div class="content-switcher-image"> {if $img != ""} - <img width=300 height=auto src="{$entry.img}"/> - {else} - <img style="display: none;"> + {image src=$entry.img width=300} {/if} </div> <div class="content-switcher-content"> <h1>{$entry.title}</h1> <p>{$entry.content}</p> </div> -</div> +</section> {/foreach} \ No newline at end of file diff --git a/lib/QUI/Bricks/Controls/Image.css b/lib/QUI/Bricks/Controls/Image.css new file mode 100644 index 0000000000000000000000000000000000000000..7068cde4d17e9f6c8158b5bf818f296d7fefcaa1 --- /dev/null +++ b/lib/QUI/Bricks/Controls/Image.css @@ -0,0 +1 @@ +/**/ \ No newline at end of file diff --git a/lib/QUI/Bricks/Controls/Image.html b/lib/QUI/Bricks/Controls/Image.html new file mode 100644 index 0000000000000000000000000000000000000000..e442680c50de3a50d64f50f64e515143c7711c9a --- /dev/null +++ b/lib/QUI/Bricks/Controls/Image.html @@ -0,0 +1,6 @@ +{assign var=img value=$brickImage} +<section> + + {image src=$brickImage} + +</section> \ No newline at end of file diff --git a/lib/QUI/Bricks/Controls/Image.php b/lib/QUI/Bricks/Controls/Image.php new file mode 100644 index 0000000000000000000000000000000000000000..4b4469b19d4c1837389ff117a6e5e489fcd9654c --- /dev/null +++ b/lib/QUI/Bricks/Controls/Image.php @@ -0,0 +1,66 @@ +<?php + +/** + * This file contains QUI\Bricks\Controls\Image + */ + +namespace QUI\Bricks\Controls; + +use QUI; + +/** + * Class Image + * + * @package quiqqer/bricks + */ + + +class Image extends QUI\Control +{ + /** + * constructor + * + * @param Array $attributes + */ + public function __construct($attributes = array()) + { + // default options + $this->setAttributes(array( + 'title' => 'Image Brick', + 'contentList' => false, + 'entries' => array() + )); + + parent::__construct($attributes); + + $this->addCSSFile( + dirname(__FILE__) . '/Image.css' + ); + } + + + /** + * (non-PHPdoc) + * + * @see \QUI\Control::create() + */ + public function getBody() + { + $Engine = QUI::getTemplateManager()->getEngine(); + $entries = $this->getAttribute('entries'); + $brickImage = $this->getAttribute('picture'); + + $Engine->assign(array( + 'this' => $this, + 'entries' => $entries, + 'brickImag' => $brickImage + )); + + + return $Engine->fetch(dirname(__FILE__).'/Image.html'); + } +} + + + + diff --git a/locale.xml b/locale.xml index 349a9462b1b081e3aaf845469d5811f5bd5137c4..435553cedc724346e47587cae0585427969a41ed 100644 --- a/locale.xml +++ b/locale.xml @@ -457,13 +457,35 @@ Möchten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de> </locale> <!-- Content Switcher --> + <locale name="brick.ContentSwitcher.title"> + <de><![CDATA[Baustein: Content Switcher]]></de> + <en><![CDATA[Brick: Content Switcher]]></en> + </locale> <locale name="ContentSwitcher.title"> <de><![CDATA[Baustein-Ãœberschrift]]></de> <en><![CDATA[]]></en> </locale> - <locale name="ContentSwitcher.socialList"> + <locale name="ContentSwitcher.entries"> <de><![CDATA[Einträge]]></de> <en><![CDATA[]]></en> </locale> + + <!-- Image Brick --> + <locale name="bricks.Image.link"> + <de><![CDATA[Baustein: Bild]]></de> + <en><![CDATA[Brick: Image]]></en> + </locale> + <locale name="Image.link"> + <de><![CDATA[Link]]></de> + <en><![CDATA[Hyperlink]]></en> + </locale> + <locale name="Image.title"> + <de><![CDATA[Baustein-Ãœberschrift]]></de> + <en><![CDATA[]]></en> + </locale> + <locale name="Image.picture"> + <de><![CDATA[Bild auswählen]]></de> + <en><![CDATA[]]></en> + </locale> </groups> </locales> \ No newline at end of file