Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/blocks/ImageTextBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -110,6 +111,13 @@ public function getText()
return empty($text) ? null : '<p>' . nl2br($text) . '</p>';
}

public function getImagePosition()
{
return ($this->getVarValue('imagePosition', 'left') == 'left')
? "margin-right:{$this->getCfgValue('margin', '20px')}"
: "margin-left:{$this->getCfgValue('margin', '20px')}";
}

/**
* @inheritdoc
*/
Expand All @@ -118,6 +126,7 @@ public function extraVars()
return [
'image' => BlockHelper::imageUpload($this->getVarValue('imageId')),
'text' => $this->getText(),
'imagePosition' => $this->getImagePosition(),
];
}

Expand Down
3 changes: 3 additions & 0 deletions src/messages/de/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/el/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/en/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/es/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/fa/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/fr/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/it/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/nl/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/pt/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/ru/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/tr/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/ua/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
3 changes: 3 additions & 0 deletions src/messages/vi/bootstrap3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
37 changes: 22 additions & 15 deletions src/views/blocks/ImageTextBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,34 @@
/**
* @var $this \luya\cms\base\PhpBlockView
*/

$image = $this->extraValue('image');
$text = $this->extraValue('text');
?>
<?php if ($this->extraValue('image') && $this->extraValue('text')): $imageCaption = $this->extraValue('image')['caption'];?>
<div>
<?= Html::img($this->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%;'),
])?>
<div>
<?= $this->extraValue('text'); ?>
<?php if ($image && $text): ?>
<?php $imageCaption = $image['caption']; ?>

<div class="media clearfix">
<div class="<?php echo ($this->varValue('imagePosition', 'left') == 'left') ? 'media-left pull-left' : 'media-right pull-right' ?>">
<?= Html::img($image['source'], [
'class' => 'media-object',
'alt' => $imageCaption === null ? '' : $imageCaption,
'title' => $imageCaption,
'width' => $this->cfgValue('width', null),
'height' => $this->cfgValue('height', null),
'style' => $this->extraValue('imagePosition') . $this->cfgValue('margin', '20px', ';margin-bottom:{{margin}};'),
]) ?>
</div>

<div class="media-body">
<?= $text; ?>
<?php if ($this->cfgValue('btnHref') && $this->cfgValue('btnLabel')): ?>
<br>
<?= Html::a($this->cfgValue('btnLabel'), $this->cfgValue('btnHref'), [
'class' => 'button',
'class' => $this->cfgValue('btnClass', 'button'),
'target' => ($this->cfgValue('targetBlank') == 1) ? '_blank' : null,
]); ?>
<?php endif; ?>
</div>
</div>
<div style="clear:both"></div>
<?php endif; ?>
<?php endif; ?>