<?php
$GLOBALS['TL_CSS'][] = \Contao\Config::get('uploadPath').'/cto_layout/css/modules/mod_pageimage.css|static';
$hasImage = isset($this->picture['img']['src']);
?>
<?php if( $hasImage ): ?>
<?php // responsive images
$arrMediaQueries = array();
if( \is_array($this->picture['sources']) )
{
foreach($this->picture['sources'] as $data)
{
if( strlen($data['media']) < 1 )
{
continue;
}
$arrMediaQueries[] = '@media '.$data['media'].' { .mod_pageimage .resp_'.$this->id.' { background-image:url('.$data['src'].') !important; } }';
}
}
if( count($arrMediaQueries) > 0 )
{
$GLOBALS['TL_HEAD'][] = '<style>'.implode("\n",$arrMediaQueries).'</style>';
}
?>
<?php $this->extend('block_unsearchable'); ?>
<?php $this->block('content'); ?>
<div class="inside resp_<?= $this->id; ?><?php if($this->Page->style_css): ?> <?= $this->Page->style_css; ?><?php endif; ?><?php if($this->Page->height_css): ?> <?= $this->Page->height_css; ?><?php endif; ?><?php if($this->bgposition): ?> <?= $this->bgposition; ?><?php endif; ?>" style="background-image: url('<?= $this->picture['img']['src']; ?>')">
<div class="container">
<div class="content">
<?php if($this->Page->imgHeadline): ?><div class="headline"><?= $this->Page->imgHeadline; ?></div><?php endif; ?>
<?php if($this->Page->imgSubheadline): ?><div class="subheadline"><?= $this->Page->imgSubheadline; ?></div><?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if($hasImage): ?>
<?php $this->endblock(); ?>
<?php endif; ?>