From 9e580c2a02073975a83ea758dc02cb12ec610aa5 Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Mon, 27 Apr 2015 12:29:02 +0200 Subject: [PATCH] Revert "Fix the usability of the image size fields (see #7565)." This reverts commit a806ec05d57f9b48320aecc8ff6f8981d045fe08. --- src/Resources/contao/config/config.php | 4 ---- src/Resources/contao/dca/tl_content.php | 2 +- src/Resources/contao/dca/tl_module.php | 2 +- src/Resources/contao/library/Contao/System.php | 13 +++++++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index f60e4c5d19..123cc0203c 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -356,10 +356,6 @@ ( 'proportional', 'box' ), - 'image_sizes' => array - ( - // placeholder - ), 'exact' => array ( 'crop', diff --git a/src/Resources/contao/dca/tl_content.php b/src/Resources/contao/dca/tl_content.php index d96a49b136..50ff5dc323 100644 --- a/src/Resources/contao/dca/tl_content.php +++ b/src/Resources/contao/dca/tl_content.php @@ -248,7 +248,7 @@ 'inputType' => 'imageSize', 'options' => System::getImageSizes(), 'reference' => &$GLOBALS['TL_LANG']['MSC'], - 'eval' => array('rgxp'=>'natural', 'nospace'=>true, 'helpwizard'=>true, 'tl_class'=>'w50'), + 'eval' => array('rgxp'=>'natural', 'includeBlankOption'=>true, 'nospace'=>true, 'helpwizard'=>true, 'tl_class'=>'w50'), 'sql' => "varchar(64) NOT NULL default ''" ), 'imagemargin' => array diff --git a/src/Resources/contao/dca/tl_module.php b/src/Resources/contao/dca/tl_module.php index 54349354fc..76c8bfaaa5 100644 --- a/src/Resources/contao/dca/tl_module.php +++ b/src/Resources/contao/dca/tl_module.php @@ -541,7 +541,7 @@ 'inputType' => 'imageSize', 'options' => System::getImageSizes(), 'reference' => &$GLOBALS['TL_LANG']['MSC'], - 'eval' => array('rgxp'=>'natural', 'nospace'=>true, 'helpwizard'=>true, 'tl_class'=>'w50'), + 'eval' => array('rgxp'=>'natural', 'includeBlankOption'=>true, 'nospace'=>true, 'helpwizard'=>true, 'tl_class'=>'w50'), 'sql' => "varchar(64) NOT NULL default ''" ), 'useCaption' => array diff --git a/src/Resources/contao/library/Contao/System.php b/src/Resources/contao/library/Contao/System.php index 38100a516e..c8a8f3323c 100644 --- a/src/Resources/contao/library/Contao/System.php +++ b/src/Resources/contao/library/Contao/System.php @@ -500,16 +500,21 @@ public static function getImageSizes() { try { + $sizes = array(); $imageSize = \Database::getInstance()->query("SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name"); while ($imageSize->next()) { - $GLOBALS['TL_CROP']['image_sizes'][$imageSize->id] = $imageSize->name . ' (' . $imageSize->width . 'x' . $imageSize->height . ')'; + $sizes[$imageSize->id] = $imageSize->name; + $sizes[$imageSize->id] .= ' (' . $imageSize->width . 'x' . $imageSize->height . ')'; } - } - catch (\Exception $e) {} - static::$arrImageSizes = $GLOBALS['TL_CROP']; + static::$arrImageSizes = array_merge(array('image_sizes' => $sizes), $GLOBALS['TL_CROP']); + } + catch (\Exception $e) + { + static::$arrImageSizes = $GLOBALS['TL_CROP']; + } } return static::$arrImageSizes;