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
12 changes: 11 additions & 1 deletion src/blocks/MapBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace luya\bootstrap3\blocks;

use Yii;
use luya\bootstrap3\Module;
use luya\bootstrap3\BaseBootstrap3Block;
use luya\bootstrap3\blockgroups\Bootstrap3Group;
Expand Down Expand Up @@ -124,6 +125,15 @@ public function extraVars()
*/
public function admin()
{
return '{% if vars.address is not empty %}<div class="iframe-container"><iframe src="{% if cfgs.snazzymapsUrl %}{{ cfgs.snazzymapsUrl }}{% else %}http://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q={{ extras.address }}&z={{ extras.zoom }}&t={{ extras.maptype }}&output=embed{% endif %}"></iframe></div>{% else %}<span class="block__empty-text">' . Module::t('block_map_no_content') . '</span>{% endif %}';
$language = Yii::$app->composition['langShortCode'];
return <<<EOT
{% if vars.address is not empty %}
<div class="iframe-container">
<iframe src="{% if cfgs.snazzymapsUrl %}{{ cfgs.snazzymapsUrl }}{% else %}http://maps.google.com/maps?f=q&source=s_q&hl={$language}&geocode=&q={{ extras.address }}&z={{ extras.zoom }}&t={{ extras.maptype }}&output=embed{% endif %}"></iframe>
</div>
{% else %}
<span class="block__empty-text">' . Module::t('block_map_no_content') . '</span>
{% endif %}
EOT;
}
}
4 changes: 2 additions & 2 deletions src/views/blocks/MapBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
?>
<?php if (!empty($this->varValue('address'))):?>
<div class="embed-responsive embed-responsive-16by9">
<iframe src="<? if ($this->cfgValue('snazzymapsUrl', false)): ?><?= $this->cfgValue('snazzymapsUrl', '') ?><? else: ?>https://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q=<?= $this->extraValue('address');?>&z=<?= $this->extraValue('zoom');?>&t=<?= $this->extraValue('maptype')?>&output=embed<? endif; ?>" width="600" height="450" frameborder="0" style="border:0"></iframe>
<iframe src="<? if ($this->cfgValue('snazzymapsUrl', false)): ?><?= $this->cfgValue('snazzymapsUrl', '') ?><? else: ?>https://maps.google.com/maps?f=q&source=s_q&hl=<?= \Yii::$app->composition['langShortCode']; ?>&geocode=&q=<?= $this->extraValue('address');?>&z=<?= $this->extraValue('zoom');?>&t=<?= $this->extraValue('maptype')?>&output=embed<? endif; ?>" width="600" height="450" frameborder="0" style="border:0"></iframe>
</div>
<?php endif; ?>
<?php endif; ?>