diff --git a/.gitignore b/.gitignore index 6b21208..dfe90e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /vendor/ /bin/ /demo/ +/assets/js/ coverage.xml diff --git a/module/dca/tl_content.php b/module/dca/tl_content.php index f790cb6..05e24a3 100644 --- a/module/dca/tl_content.php +++ b/module/dca/tl_content.php @@ -2,7 +2,7 @@ $GLOBALS['TL_DCA']['tl_content']['metapalettes']['leaflet'] = array( 'type' => array('type', 'headline'), - 'leaflet' => array('leaflet_map'), + 'leaflet' => array('leaflet_map', 'leaflet_width', 'leaflet_height'), 'templates' => array(':hide', 'customTpl'), 'protected' => array(':hide', 'protected'), 'expert' => array(':hide', 'guests', 'cssID', 'space'), @@ -20,3 +20,24 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_map'] = array( ), 'sql' => "int(10) unsigned NOT NULL default '0'" ); + +$GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_width'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_width'], + 'inputType' => 'inputUnit', + 'options' => array('px', '%', 'em', 'pt', 'pc', 'in', 'cm', 'mm'), + 'search' => false, + 'exclude' => true, + 'eval' => array('rgxp' => 'digit', 'tl_class' => 'clr w50'), + 'sql' => "varchar(64) NOT NULL default ''" +); + + +$GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_height'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_height'], + 'inputType' => 'inputUnit', + 'options' => array('px', '%', 'em', 'pt', 'pc', 'in', 'cm', 'mm'), + 'search' => false, + 'exclude' => true, + 'eval' => array('rgxp' => 'digit', 'tl_class' => 'w50'), + 'sql' => "varchar(64) NOT NULL default ''" +); diff --git a/module/templates/ce_leaflet_map.html5 b/module/templates/ce_leaflet_map.html5 index 711f43e..e88bc5b 100644 --- a/module/templates/ce_leaflet_map.html5 +++ b/module/templates/ce_leaflet_map.html5 @@ -5,7 +5,7 @@ <hl; ?>>headline; ?>hl; ?>> -
+
map): ?> '; $this->Template->mapId = $mapId; -// $this->Template->map = $map; + + $style = ''; + $height = deserialize($this->leaflet_height, true); + $width = deserialize($this->leaflet_width, true); + + if (!empty($width['value'])) { + $style .= 'width:' . $width['value'] . $width['unit'] . ';'; + } + + if (!empty($height['value'])) { + $style .= 'height:' . $height['value'] . $height['unit'] . ';'; + } + + $this->Template->mapStyle = $style; } catch(\Exception $e) { throw $e; }