From 18e049552d918f644f725f1f9b512d03e65d651c Mon Sep 17 00:00:00 2001 From: boehsermoe Date: Thu, 30 Aug 2018 08:51:59 +0200 Subject: [PATCH 1/4] Bootstrap 3 media object https://getbootstrap.com/docs/3.3/components/#media-default --- src/views/blocks/ImageTextBlock.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/views/blocks/ImageTextBlock.php b/src/views/blocks/ImageTextBlock.php index 2a40d20..9ab5328 100644 --- a/src/views/blocks/ImageTextBlock.php +++ b/src/views/blocks/ImageTextBlock.php @@ -6,16 +6,18 @@ */ ?> extraValue('image') && $this->extraValue('text')): $imageCaption = $this->extraValue('image')['caption'];?> -
- extraValue('image')['source'], [ - 'class' => ($this->varValue('imagePosition', 'left') == 'left') ? 'pull-left img-responsive' : 'pull-right img-responsive', - 'alt' => $imageCaption === null ? '' : $imageCaption, - 'title' => $imageCaption, - 'width' => $this->cfgValue('width', null), - 'height' => $this->cfgValue('height', null), - 'style' => (($this->varValue('imagePosition', 'left') == 'left') ? "margin-right:{$this->cfgValue('margin', '20px')}" : "margin-left:{$this->cfgValue('margin', '20px')}") . $this->cfgValue('margin', '20px', ';margin-bottom:{{margin}};max-width:50%;'), - ])?> -
+
+
+ extraValue('image')['source'], [ + 'class' => 'media-object', + 'alt' => $imageCaption === null ? '' : $imageCaption, + 'title' => $imageCaption, + 'width' => $this->cfgValue('width', null), + 'height' => $this->cfgValue('height', null), + ]) ?> +
+ +
extraValue('text'); ?> cfgValue('btnHref') && $this->cfgValue('btnLabel')): ?>
@@ -26,5 +28,4 @@
-
- \ No newline at end of file + From ae862bccf6cc49701d19d5e0c2ad8b90c0160459 Mon Sep 17 00:00:00 2001 From: boehsermoe Date: Thu, 30 Aug 2018 12:25:13 +0200 Subject: [PATCH 2/4] Update ImageTextBlock.php --- src/views/blocks/ImageTextBlock.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/blocks/ImageTextBlock.php b/src/views/blocks/ImageTextBlock.php index 9ab5328..2ff7722 100644 --- a/src/views/blocks/ImageTextBlock.php +++ b/src/views/blocks/ImageTextBlock.php @@ -14,6 +14,7 @@ 'title' => $imageCaption, 'width' => $this->cfgValue('width', null), 'height' => $this->cfgValue('height', null), + 'style' => (($this->varValue('imagePosition', 'left') == 'left') ? "margin-right:{$this->cfgValue('margin', '20px')}" : "margin-left:{$this->cfgValue('margin', '20px')}") . $this->cfgValue('margin', '20px', ';margin-bottom:{{margin}};'), ]) ?>
From 4a73899dd83f1d65d18302bfa9685f7f1699f5be Mon Sep 17 00:00:00 2001 From: boehsermoe Date: Sat, 1 Sep 2018 15:55:12 +0200 Subject: [PATCH 3/4] Refactoring ImageTextBlock --- src/blocks/ImageTextBlock.php | 9 +++++++++ src/messages/de/bootstrap3.php | 3 +++ src/messages/el/bootstrap3.php | 3 +++ src/messages/en/bootstrap3.php | 3 +++ src/messages/es/bootstrap3.php | 3 +++ src/messages/fa/bootstrap3.php | 3 +++ src/messages/fr/bootstrap3.php | 3 +++ src/messages/it/bootstrap3.php | 3 +++ src/messages/nl/bootstrap3.php | 3 +++ src/messages/pt/bootstrap3.php | 3 +++ src/messages/ru/bootstrap3.php | 3 +++ src/messages/tr/bootstrap3.php | 3 +++ src/messages/ua/bootstrap3.php | 3 +++ src/messages/vi/bootstrap3.php | 3 +++ src/views/blocks/ImageTextBlock.php | 15 ++++++++++----- 15 files changed, 58 insertions(+), 5 deletions(-) diff --git a/src/blocks/ImageTextBlock.php b/src/blocks/ImageTextBlock.php index a0efdf4..3193888 100644 --- a/src/blocks/ImageTextBlock.php +++ b/src/blocks/ImageTextBlock.php @@ -77,6 +77,7 @@ public function config() ], ['var' => 'btnLabel', 'label' => Module::t('block_image_text_btnlabel_label'), 'type' => 'zaa-text'], ['var' => 'btnHref', 'label' => Module::t('block_image_text_btnhref_label'), 'type' => 'zaa-text'], + ['var' => 'btnClass', 'label' => Module::t('block_image_text_btnclass_label'), 'type' => 'zaa-text'], ['var' => 'targetBlank', 'label' => Module::t('block_image_text_targetblank_label'), 'type' => 'zaa-checkbox'], ['var' => 'width', 'label' => Module::t('block_image_fixed_width'), 'type' => 'zaa-text'], ['var' => 'height', 'label' => Module::t('block_image_fixed_height'), 'type' => 'zaa-text'], @@ -110,6 +111,13 @@ public function getText() return empty($text) ? null : '

' . nl2br($text) . '

'; } + public function getImagePosition() + { + return ($this->getVarValue('imagePosition', 'left') == 'left') + ? "margin-right:{$this->getCfgValue('margin', '20px')}" + : "margin-left:{$this->getCfgValue('margin', '20px')}"; + } + /** * @inheritdoc */ @@ -118,6 +126,7 @@ public function extraVars() return [ 'image' => BlockHelper::imageUpload($this->getVarValue('imageId')), 'text' => $this->getText(), + 'imagePosition' => $this->getImagePosition(), ]; } diff --git a/src/messages/de/bootstrap3.php b/src/messages/de/bootstrap3.php index 2c10412..0c80223 100644 --- a/src/messages/de/bootstrap3.php +++ b/src/messages/de/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'Die iFrame URL von Snazzy Maps, überschreibt jegliche andere Konfiguration und zeigt die Snazzy Map an.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS-Klasse', ]; diff --git a/src/messages/el/bootstrap3.php b/src/messages/el/bootstrap3.php index 094fc27..00a235a 100644 --- a/src/messages/el/bootstrap3.php +++ b/src/messages/el/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/en/bootstrap3.php b/src/messages/en/bootstrap3.php index ae57397..d9daf63 100644 --- a/src/messages/en/bootstrap3.php +++ b/src/messages/en/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other settings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/es/bootstrap3.php b/src/messages/es/bootstrap3.php index 00be2aa..0c4a832 100644 --- a/src/messages/es/bootstrap3.php +++ b/src/messages/es/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/fa/bootstrap3.php b/src/messages/fa/bootstrap3.php index 0a04606..f11f33c 100644 --- a/src/messages/fa/bootstrap3.php +++ b/src/messages/fa/bootstrap3.php @@ -101,4 +101,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/fr/bootstrap3.php b/src/messages/fr/bootstrap3.php index 9549f5c..4992fb4 100644 --- a/src/messages/fr/bootstrap3.php +++ b/src/messages/fr/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'URL de l\'iframe Snazzy Maps', 'block_map_snazzymapsUrl_help' => 'L\'URL de l\'iframe Snazzy Maps écrasera tous les autres paramètres et affichera la Snazzy Map telle que configurée.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/it/bootstrap3.php b/src/messages/it/bootstrap3.php index 0bfca92..907723c 100644 --- a/src/messages/it/bootstrap3.php +++ b/src/messages/it/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/nl/bootstrap3.php b/src/messages/nl/bootstrap3.php index 16d9d92..ae81f69 100644 --- a/src/messages/nl/bootstrap3.php +++ b/src/messages/nl/bootstrap3.php @@ -100,4 +100,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'De iRoom- URL van Snazzy Maps overschrijft alle andere instellingen en geeft de geconfigureerde Snazzy Map weer.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/pt/bootstrap3.php b/src/messages/pt/bootstrap3.php index ef7a144..b2c8cc6 100644 --- a/src/messages/pt/bootstrap3.php +++ b/src/messages/pt/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/ru/bootstrap3.php b/src/messages/ru/bootstrap3.php index 2438302..696186c 100644 --- a/src/messages/ru/bootstrap3.php +++ b/src/messages/ru/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/tr/bootstrap3.php b/src/messages/tr/bootstrap3.php index 708f204..24d6ef3 100644 --- a/src/messages/tr/bootstrap3.php +++ b/src/messages/tr/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Haritaları iFrame URL', 'block_map_snazzymapsUrl_help' => 'Snazzy Haritaları iFrame URL\'si, diğer tüm ayarların üzerine yazacak ve yapılandırılmış Snazzy haritaları görüntüleyecek.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/ua/bootstrap3.php b/src/messages/ua/bootstrap3.php index ea71ee7..c588a0d 100644 --- a/src/messages/ua/bootstrap3.php +++ b/src/messages/ua/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/messages/vi/bootstrap3.php b/src/messages/vi/bootstrap3.php index 3fa7ea0..27b5a27 100644 --- a/src/messages/vi/bootstrap3.php +++ b/src/messages/vi/bootstrap3.php @@ -102,4 +102,7 @@ // 1.0.2 'block_map_snazzymapsUrl_label' => 'Snazzy Maps iFrame URL', 'block_map_snazzymapsUrl_help' => 'The Snazzy Maps iFrame URL, will overwrite all other setings and display the configured Snazzy Map.', + + // 1.0.4 + 'block_image_text_btnclass_label' => 'Button CSS class', ]; diff --git a/src/views/blocks/ImageTextBlock.php b/src/views/blocks/ImageTextBlock.php index 2ff7722..18c6a05 100644 --- a/src/views/blocks/ImageTextBlock.php +++ b/src/views/blocks/ImageTextBlock.php @@ -4,26 +4,31 @@ /** * @var $this \luya\cms\base\PhpBlockView */ + +$image = $this->extraValue('image'); +$text = $this->extraValue('text'); ?> -extraValue('image') && $this->extraValue('text')): $imageCaption = $this->extraValue('image')['caption'];?> + + +
- extraValue('image')['source'], [ + 'media-object', 'alt' => $imageCaption === null ? '' : $imageCaption, 'title' => $imageCaption, 'width' => $this->cfgValue('width', null), 'height' => $this->cfgValue('height', null), - 'style' => (($this->varValue('imagePosition', 'left') == 'left') ? "margin-right:{$this->cfgValue('margin', '20px')}" : "margin-left:{$this->cfgValue('margin', '20px')}") . $this->cfgValue('margin', '20px', ';margin-bottom:{{margin}};'), + 'style' => $this->extraValue('imagePosition') . $this->cfgValue('margin', '20px', ';margin-bottom:{{margin}};'), ]) ?>
- extraValue('text'); ?> + cfgValue('btnHref') && $this->cfgValue('btnLabel')): ?>
cfgValue('btnLabel'), $this->cfgValue('btnHref'), [ - 'class' => 'button', + 'class' => $this->cfgValue('btnClass', 'button'), 'target' => ($this->cfgValue('targetBlank') == 1) ? '_blank' : null, ]); ?> From 4f85633f1baa72e18db5a48959fd504a5a81fc59 Mon Sep 17 00:00:00 2001 From: boehsermoe Date: Sat, 1 Sep 2018 16:01:34 +0200 Subject: [PATCH 4/4] Added clearfix --- src/views/blocks/ImageTextBlock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/blocks/ImageTextBlock.php b/src/views/blocks/ImageTextBlock.php index 18c6a05..fe561da 100644 --- a/src/views/blocks/ImageTextBlock.php +++ b/src/views/blocks/ImageTextBlock.php @@ -11,7 +11,7 @@ -
+
'media-object',