diff --git a/src/Controller/ContentElement/ColumnStartController.php b/src/Controller/ContentElement/ColumnStartController.php new file mode 100644 index 0000000..7e7aaff --- /dev/null +++ b/src/Controller/ContentElement/ColumnStartController.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\Controller\ContentElement; + +use Contao\BackendTemplate; +use Contao\ContentModel; +use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController; +use Contao\CoreBundle\Image\Studio\Studio; +use Contao\CoreBundle\Routing\ScopeMatcher; +use Contao\CoreBundle\ServiceAnnotation\ContentElement; +use Contao\StringUtil; +use Contao\Template; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +/** + * Column start content element + * + * @author Martin Auswöger + * + * @ContentElement("rs_column_start", category="rs_columns") + */ +class ColumnStartController extends AbstractContentElementController +{ + private ScopeMatcher $scopeMatcher; + private Studio $studio; + + public function __construct(ScopeMatcher $scopeMatcher, Studio $studio) + { + $this->scopeMatcher = $scopeMatcher; + $this->studio = $studio; + } + + protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response + { + if ($this->scopeMatcher->isBackendRequest($request)) { + $backendTemplate = new BackendTemplate('be_wildcard'); + $backendTemplate->title = $template->headline; + return new Response($backendTemplate->parse()); + } + + $classes = array('rs-column'); + $styles = array(); + $parentKey = ($model->ptable ?: 'tl_article') . '__' . $model->pid; + + if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { + + $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] = false; + $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++; + + $count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']; + foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) { + $classes = array_merge($classes, $media[($count - 1) % count($media)]); + if ($count - 1 < count($media)) { + $classes[] = '-' . $name . '-first-row'; + } + } + + } + else { + trigger_error('Missing column wrapper start element before column start element ID ' . $model->id . '.', E_USER_WARNING); + } + + if ($model->rs_column_color_inverted) { + $classes[] = '-color-inverted'; + } + + if ($model->rs_column_background) { + + $backgroundColor = StringUtil::deserialize($model->rs_column_background_color); + if (is_array($backgroundColor) && $backgroundColor[0]) { + $styles[] = 'background-color: #' . $backgroundColor[0] . ';'; + } + + if (trim($model->rs_column_background_image)) { + $figure = $this->studio + ->createFigureBuilder() + ->fromUuid($model->rs_column_background_image ?: '') + ->setSize($model->rs_column_background_image_size) + ->enableLightbox(false) + ->buildIfResourceExists() + ; + if (null !== $figure) { + $styles[] = 'background-image: url("' . $figure->getImage()->getImageSrc(true) . '");'; + } + } + + if ($model->rs_column_background_size) { + $styles[] = 'background-size: ' . $model->rs_column_background_size . ';'; + } + + if ($model->rs_column_background_position) { + $styles[] = 'background-position: ' . $model->rs_column_background_position . ';'; + } + + if ($model->rs_column_background_repeat) { + $styles[] = 'background-repeat: ' . $model->rs_column_background_repeat . ';'; + } + + } + + $template->class .= ' ' . implode(' ', $classes); + $template->style = implode(' ', $styles); + + return new Response($template->parse()); + } +} diff --git a/src/Controller/ContentElement/ColumnStopController.php b/src/Controller/ContentElement/ColumnStopController.php new file mode 100644 index 0000000..ef34c6a --- /dev/null +++ b/src/Controller/ContentElement/ColumnStopController.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\Controller\ContentElement; + +use Contao\BackendTemplate; +use Contao\ContentModel; +use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController; +use Contao\CoreBundle\Routing\ScopeMatcher; +use Contao\CoreBundle\ServiceAnnotation\ContentElement; +use Contao\Template; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +/** + * Column stop content element + * + * @author Martin Auswöger + * + * @ContentElement("rs_column_stop", category="rs_columns") + */ +class ColumnStopController extends AbstractContentElementController +{ + private ScopeMatcher $scopeMatcher; + + public function __construct(ScopeMatcher $scopeMatcher) + { + $this->scopeMatcher = $scopeMatcher; + } + + protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response + { + if ($this->scopeMatcher->isBackendRequest($request)) { + $backendTemplate = new BackendTemplate('be_wildcard'); + return new Response($backendTemplate->parse()); + } + + $parentKey = ($model->ptable ?: 'tl_article') . '__' . $model->pid; + + if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) && !$GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { + $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] = true; + } + else { + trigger_error('Missing column start element before column stop element ID ' . $model->id . '.', E_USER_WARNING); + } + + return new Response($template->parse()); + } +} diff --git a/src/Element/ColumnsStart.php b/src/Controller/ContentElement/ColumnsStartController.php similarity index 58% rename from src/Element/ColumnsStart.php rename to src/Controller/ContentElement/ColumnsStartController.php index 49538ad..dad65ef 100644 --- a/src/Element/ColumnsStart.php +++ b/src/Controller/ContentElement/ColumnsStartController.php @@ -6,38 +6,42 @@ * file that was distributed with this source code. */ -namespace MadeYourDay\RockSolidColumns\Element; +namespace MadeYourDay\RockSolidColumns\Controller\ContentElement; use Contao\BackendTemplate; -use Contao\ContentElement; -use Contao\FrontendTemplate; -use Contao\System; +use Contao\ContentModel; +use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController; +use Contao\CoreBundle\Routing\ScopeMatcher; +use Contao\CoreBundle\ServiceAnnotation\ContentElement; +use Contao\Template; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; /** * Columns start content element * * @author Martin Auswöger + * + * @ContentElement("rs_columns_start", category="rs_columns") */ -class ColumnsStart extends ContentElement +class ColumnsStartController extends AbstractContentElementController { - /** - * @var string Template - */ - protected $strTemplate = 'ce_rs_columns_start'; + private ScopeMatcher $scopeMatcher; - /** - * Parse the template - * - * @return string Parsed element - */ - public function generate() + public function __construct(ScopeMatcher $scopeMatcher) + { + $this->scopeMatcher = $scopeMatcher; + } + + protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - return parent::generate(); + if ($this->scopeMatcher->isBackendRequest($request)) { + $backendTemplate = new BackendTemplate('be_wildcard'); + $backendTemplate->title = $template->headline; + return new Response($backendTemplate->parse()); } - $parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid']; + $parentKey = ($model->ptable ?: 'tl_article') . '__' . $model->pid; $htmlPrefix = ''; @@ -70,24 +74,21 @@ public function generate() $GLOBALS['TL_RS_COLUMNS'][$parentKey] = array( 'active' => true, 'count' => 0, - 'config' => static::getColumnsConfiguration($this->arrData), + 'config' => static::getColumnsConfiguration($model->row()), ); - if (!is_array($this->cssID)) { - $this->cssID = array('', ''); - } - $this->arrData['cssID'][1] .= ' ' . static::getWrapperClassName($this->arrData); + $template->class .= ' ' . static::getWrapperClassName($model->row()); - return $htmlPrefix . parent::generate(); + return new Response($htmlPrefix . $template->parse()); } /** * Generate the columns configuration * * @param array $data Data array - * @return array Columns configuration + * @return array Columns configuration */ - public static function getColumnsConfiguration(array $data) + public static function getColumnsConfiguration(array $data): array { $config = array(); $lastColumns = null; @@ -99,15 +100,13 @@ public static function getColumnsConfiguration(array $data) foreach (array('xlarge', 'large', 'medium', 'small', 'xsmall') as $media) { - $columns = isset($data['rs_columns_' . $media]) - ? $data['rs_columns_' . $media] - : null; + $columns = $data['rs_columns_'.$media] ?? null; if (!$columns) { $columns = $lastColumns ?: '2'; } $lastColumns = $columns; - $columns = array_map(function($value) { + $columns = array_map(static function($value) { return (int)$value ?: 1; }, explode('-', $columns)); @@ -115,11 +114,11 @@ public static function getColumnsConfiguration(array $data) $columns = array_fill(0, (int)$columns[0], '1'); } - $columnsTotal = array_reduce($columns, function($a, $b) { + $columnsTotal = array_reduce($columns, static function($a, $b) { return $a + $b; }); $classes = array(); - foreach ($columns as $key => $column) { + foreach ($columns as $column) { $classes[] = array('-' . $media . '-col-' . $columnsTotal . '-' . $column); } $classes[0][] = '-' . $media . '-first'; @@ -135,9 +134,9 @@ public static function getColumnsConfiguration(array $data) * Generate the wrapper class name * * @param array $data Data array - * @return string Wrapper class name + * @return string Wrapper class name */ - public static function getWrapperClassName(array $data) + public static function getWrapperClassName(array $data): string { $classes = array('rs-columns'); @@ -155,22 +154,4 @@ public static function getWrapperClassName(array $data) return implode(' ', $classes); } - - /** - * Compile the content element - * - * @return void - */ - public function compile() - { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - $this->strTemplate = 'be_wildcard'; - $this->Template = new BackendTemplate($this->strTemplate); - $this->Template->title = $this->headline; - } - else { - $this->Template = new FrontendTemplate($this->strTemplate); - $this->Template->setData($this->arrData); - } - } } diff --git a/src/Controller/ContentElement/ColumnsStopController.php b/src/Controller/ContentElement/ColumnsStopController.php new file mode 100644 index 0000000..38657a7 --- /dev/null +++ b/src/Controller/ContentElement/ColumnsStopController.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\Controller\ContentElement; + +use Contao\BackendTemplate; +use Contao\ContentModel; +use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController; +use Contao\CoreBundle\Routing\ScopeMatcher; +use Contao\CoreBundle\ServiceAnnotation\ContentElement; +use Contao\Template; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +/** + * Columns stop content element + * + * @author Martin Auswöger + * + * @ContentElement("rs_columns_stop", category="rs_columns") + */ +class ColumnsStopController extends AbstractContentElementController +{ + private ScopeMatcher $scopeMatcher; + + public function __construct(ScopeMatcher $scopeMatcher) + { + $this->scopeMatcher = $scopeMatcher; + } + + protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response + { + if ($this->scopeMatcher->isBackendRequest($request)) { + $backendTemplate = new BackendTemplate('be_wildcard'); + return new Response($backendTemplate->parse()); + } + + $parentKey = ($model->ptable ?: 'tl_article') . '__' . $model->pid; + + if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey])) { + if (!$GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { + trigger_error('Missing column stop element before column wrapper stop element ID ' . $model->id . '.', E_USER_WARNING); + } + unset($GLOBALS['TL_RS_COLUMNS'][$parentKey]); + } + else { + trigger_error('Missing column wrapper start element before column wrapper stop element ID ' . $model->id . '.', E_USER_WARNING); + } + + $htmlSuffix = ''; + + if (!empty($GLOBALS['TL_RS_COLUMNS_STACK'][$parentKey])) { + $GLOBALS['TL_RS_COLUMNS'][$parentKey] = array_pop($GLOBALS['TL_RS_COLUMNS_STACK'][$parentKey]); + if ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { + $htmlSuffix .= ''; + } + } + + return new Response($template->parse() . $htmlSuffix); + } + +} diff --git a/src/DependencyInjection/RockSolidColumnsExtension.php b/src/DependencyInjection/RockSolidColumnsExtension.php new file mode 100644 index 0000000..2f01b83 --- /dev/null +++ b/src/DependencyInjection/RockSolidColumnsExtension.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\DependencyInjection; + +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + +final class RockSolidColumnsExtension extends Extension +{ + public function load(array $configs, ContainerBuilder $container): void + { + (new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'))) + ->load('services.yaml') + ; + } +} diff --git a/src/Element/ColumnStart.php b/src/Element/ColumnStart.php deleted file mode 100644 index 09ef3e9..0000000 --- a/src/Element/ColumnStart.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace MadeYourDay\RockSolidColumns\Element; - -use Contao\BackendTemplate; -use Contao\ContentElement; -use Contao\File; -use Contao\FilesModel; -use Contao\FrontendTemplate; -use Contao\StringUtil; -use Contao\System; -use Symfony\Component\HttpFoundation\Request; - -/** - * Column start content element - * - * @author Martin Auswöger - */ -class ColumnStart extends ContentElement -{ - /** - * @var string Template - */ - protected $strTemplate = 'ce_rs_column_start'; - - /** - * Parse the template - * - * @return string Parsed element - */ - public function generate() - { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - return parent::generate(); - } - - $classes = array('rs-column'); - $parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid']; - - if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { - - $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] = false; - $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++; - - $count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']; - foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) { - $classes = array_merge($classes, $media[($count - 1) % count($media)]); - if ($count - 1 < count($media)) { - $classes[] = '-' . $name . '-first-row'; - } - } - - } - else { - trigger_error('Missing column wrapper start element before column start element ID ' . $this->id . '.', E_USER_WARNING); - } - - if ($this->rs_column_color_inverted) { - $classes[] = '-color-inverted'; - } - - if ($this->rs_column_background) { - - $backgroundColor = StringUtil::deserialize($this->rs_column_background_color); - if (is_array($backgroundColor) && $backgroundColor[0]) { - $this->arrStyle[] = 'background-color: #' . $backgroundColor[0] . ';'; - } - - if (trim($this->rs_column_background_image)) { - $image = FilesModel::findByPk($this->rs_column_background_image); - $file = new File($image->path, true); - $imageObject = new \stdClass(); - $this->addImageToTemplate($imageObject, array( - 'id' => $image->id, - 'uuid' => isset($image->uuid) ? $image->uuid : null, - 'name' => $file->basename, - 'singleSRC' => $image->path, - 'size' => $this->rs_column_background_image_size, - )); - $this->arrStyle[] = 'background-image: url("' . $imageObject->src . '");'; - } - - if ($this->rs_column_background_size) { - $this->arrStyle[] = 'background-size: ' . $this->rs_column_background_size . ';'; - } - - if ($this->rs_column_background_position) { - $this->arrStyle[] = 'background-position: ' . $this->rs_column_background_position . ';'; - } - - if ($this->rs_column_background_repeat) { - $this->arrStyle[] = 'background-repeat: ' . $this->rs_column_background_repeat . ';'; - } - - } - - if (!is_array($this->cssID)) { - $this->cssID = array('', ''); - } - else { - $this->cssID = $this->cssID + array('', ''); - } - - $this->arrData['cssID'][1] .= ' ' . implode(' ', $classes); - - return parent::generate(); - } - - /** - * Compile the content element - * - * @return void - */ - public function compile() - { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - $this->strTemplate = 'be_wildcard'; - $this->Template = new BackendTemplate($this->strTemplate); - $this->Template->title = $this->headline; - } - else { - $this->Template = new FrontendTemplate($this->strTemplate); - $this->Template->setData($this->arrData); - } - } -} diff --git a/src/Element/ColumnStop.php b/src/Element/ColumnStop.php deleted file mode 100644 index 1693e5c..0000000 --- a/src/Element/ColumnStop.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace MadeYourDay\RockSolidColumns\Element; - -use Contao\BackendTemplate; -use Contao\ContentElement; -use Contao\FrontendTemplate; -use Contao\System; -use Symfony\Component\HttpFoundation\Request; - -/** - * Column stop content element - * - * @author Martin Auswöger - */ -class ColumnStop extends ContentElement -{ - /** - * @var string Template - */ - protected $strTemplate = 'ce_rs_column_stop'; - - /** - * Parse the template - * - * @return string Parsed element - */ - public function generate() - { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - return parent::generate(); - } - - $parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid']; - if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) && !$GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { - $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] = true; - } - else { - trigger_error('Missing column start element before column stop element ID ' . $this->id . '.', E_USER_WARNING); - } - - return parent::generate(); - } - - /** - * Compile the content element - * - * @return void - */ - public function compile() - { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - $this->strTemplate = 'be_wildcard'; - $this->Template = new BackendTemplate($this->strTemplate); - $this->Template->title = $this->headline; - } - else { - $this->Template = new FrontendTemplate($this->strTemplate); - $this->Template->setData($this->arrData); - } - } -} diff --git a/src/Element/ColumnsStop.php b/src/Element/ColumnsStop.php deleted file mode 100644 index c0ed107..0000000 --- a/src/Element/ColumnsStop.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace MadeYourDay\RockSolidColumns\Element; - -use Contao\BackendTemplate; -use Contao\ContentElement; -use Contao\FrontendTemplate; -use Contao\System; -use Symfony\Component\HttpFoundation\Request; - -/** - * Columns stop content element - * - * @author Martin Auswöger - */ -class ColumnsStop extends ContentElement -{ - /** - * @var string Template - */ - protected $strTemplate = 'ce_rs_columns_stop'; - - /** - * Parse the template - * - * @return string Parsed element - */ - public function generate() - { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - return parent::generate(); - } - - $parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid']; - if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey])) { - if (!$GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { - trigger_error('Missing column stop element before column wrapper stop element ID ' . $this->id . '.', E_USER_WARNING); - } - unset($GLOBALS['TL_RS_COLUMNS'][$parentKey]); - } - else { - trigger_error('Missing column wrapper start element before column wrapper stop element ID ' . $this->id . '.', E_USER_WARNING); - } - - $htmlSuffix = ''; - - if (!empty($GLOBALS['TL_RS_COLUMNS_STACK'][$parentKey])) { - $GLOBALS['TL_RS_COLUMNS'][$parentKey] = array_pop($GLOBALS['TL_RS_COLUMNS_STACK'][$parentKey]); - if ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) { - $htmlSuffix .= ''; - } - } - - return parent::generate() . $htmlSuffix; - } - - /** - * Compile the content element - * - * @return void - */ - public function compile() - { - if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - $this->strTemplate = 'be_wildcard'; - $this->Template = new BackendTemplate($this->strTemplate); - $this->Template->title = $this->headline; - } - else { - $this->Template = new FrontendTemplate($this->strTemplate); - $this->Template->setData($this->arrData); - } - } -} diff --git a/src/EventListener/AddColumnsClassesToContentListener.php b/src/EventListener/AddColumnsClassesToContentListener.php new file mode 100644 index 0000000..6be4864 --- /dev/null +++ b/src/EventListener/AddColumnsClassesToContentListener.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\EventListener; + +use Contao\ContentModel; +use Contao\CoreBundle\ServiceAnnotation\Hook; + +/** + * @Hook("getContentElement") + */ +class AddColumnsClassesToContentListener +{ + public function __invoke(ContentModel $contentModel, string $buffer, $element): string + { + $parentKey = ($contentModel->ptable ?: 'tl_article').'__'.$contentModel->pid; + $excludeElements = ['rs_columns_start', 'rs_columns_stop', 'rs_column_start', 'rs_column_stop']; + + if ( + isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) + && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] + && !\in_array($contentModel->type, $excludeElements, true) + ) { + + $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++; + $count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']; + + if ($count) { + + $classes = array('rs-column'); + foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) { + $classes = array_merge($classes, $media[($count - 1) % count($media)]); + if ($count - 1 < count($media)) { + $classes[] = '-'.$name.'-first-row'; + } + } + + return '
'.$buffer.'
'; + + } + + } + + return $buffer; + } +} diff --git a/src/EventListener/AddColumnsClassesToFormListener.php b/src/EventListener/AddColumnsClassesToFormListener.php new file mode 100644 index 0000000..02bab77 --- /dev/null +++ b/src/EventListener/AddColumnsClassesToFormListener.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\EventListener; + +use Contao\CoreBundle\ServiceAnnotation\Hook; +use Contao\Form; +use Contao\Widget; + +/** + * @Hook("loadFormField") + */ +class AddColumnsClassesToFormListener +{ + public function __invoke(Widget $widget, string $formId, array $data, Form $form): Widget + { + $parentKey = 'tl_form__'.$widget->pid; + $excludeWidgets = ['rs_columns_start', 'rs_columns_stop', 'rs_column_start', 'rs_column_stop']; + + if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) + && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] + && !\in_array($widget->type, $excludeWidgets, true) + ) { + + $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++; + $count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']; + + if ($count) { + + $classes = array('rs-column'); + foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) { + $classes = array_merge($classes, $media[($count - 1) % count($media)]); + if ($count - 1 < count($media)) { + $classes[] = '-'.$name.'-first-row'; + } + } + + if ('fieldsetStart' === $widget->type || 'submit' === $widget->type) { + $widget->class .= ' '.implode(' ', $classes); + } else { + $widget->prefix .= ' '.implode(' ', $classes); + } + } + } + + return $widget; + } +} diff --git a/src/EventListener/AddFrontendAssetsListener.php b/src/EventListener/AddFrontendAssetsListener.php new file mode 100644 index 0000000..f9e8ad6 --- /dev/null +++ b/src/EventListener/AddFrontendAssetsListener.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\EventListener; + +use Contao\CoreBundle\ServiceAnnotation\Hook; +use Contao\PageRegular; +use Contao\LayoutModel; +use Contao\PageModel; + +/** + * @Hook("generatePage") + */ +class AddFrontendAssetsListener +{ + public function __invoke(PageModel $pageModel, LayoutModel $layout, PageRegular $pageRegular): void + { + if ($layout->rs_columns_load_css) { + $GLOBALS['TL_CSS'][] = 'bundles/rocksolidcolumns/css/columns.css||static'; + } + } +} diff --git a/src/EventListener/DataContainer/AddBackendAssetsListener.php b/src/EventListener/DataContainer/AddBackendAssetsListener.php new file mode 100644 index 0000000..230d612 --- /dev/null +++ b/src/EventListener/DataContainer/AddBackendAssetsListener.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\EventListener\DataContainer; + +use Contao\CoreBundle\Routing\ScopeMatcher; +use Contao\CoreBundle\ServiceAnnotation\Hook; +use Contao\System; +use Symfony\Component\HttpFoundation\RequestStack; + +/** + * @Hook("loadDataContainer") + */ +class AddBackendAssetsListener +{ + private RequestStack $requestStack; + private ScopeMatcher $scopeMatcher; + + public function __construct(RequestStack $requestStack, ScopeMatcher $scopeMatcher) + { + $this->requestStack = $requestStack; + $this->scopeMatcher = $scopeMatcher; + } + + public function __invoke(string $table): void + { + if ('tl_content' !== $table && 'tl_form_field' !== $table) { + return; + } + + $request = $this->requestStack->getCurrentRequest(); + + if (null === $request || !$this->scopeMatcher->isBackendRequest($request)) { + return; + } + + $GLOBALS['TL_CSS'][] = 'bundles/rocksolidcolumns/css/be_main.css'; + + if ('tl_form_field' === $table) { + System::loadLanguageFile('tl_content'); + } + } +} diff --git a/src/Columns.php b/src/EventListener/DataContainer/CreateStopElementsSubmitCallbackListener.php similarity index 52% rename from src/Columns.php rename to src/EventListener/DataContainer/CreateStopElementsSubmitCallbackListener.php index 63803a7..387071d 100644 --- a/src/Columns.php +++ b/src/EventListener/DataContainer/CreateStopElementsSubmitCallbackListener.php @@ -6,90 +6,19 @@ * file that was distributed with this source code. */ -namespace MadeYourDay\RockSolidColumns; +namespace MadeYourDay\RockSolidColumns\EventListener\DataContainer; +use Contao\CoreBundle\ServiceAnnotation\Callback; use Contao\Database; use Contao\DataContainer; -use Contao\Encryption; -use Contao\LayoutModel; -use Contao\PageModel; -use Contao\PageRegular; /** - * RockSolid Columns DCA (tl_content and tl_module) - * - * Provide miscellaneous methods that are used by the data configuration arrays. - * - * @author Martin Auswöger + * @Callback(table="tl_content", target="config.onsubmit") + * @Callback(table="tl_form_field", target="config.onsubmit") */ -class Columns +class CreateStopElementsSubmitCallbackListener { - /** - * generatePage hook - * - * @param PageModel $page - * @param LayoutModel $layout - * @param PageRegular $pageRegular - * @return void - */ - public function generatePageHook(PageModel $page, LayoutModel $layout, PageRegular $pageRegular) - { - if ($layout->rs_columns_load_css) { - $GLOBALS['TL_CSS'][] = 'bundles/rocksolidcolumns/css/columns.css||static'; - } - } - - /** - * getContentElement hook - * - * @param Object $row content element - * @param string $content html content - * @return string modified $content - */ - public function getContentElementHook($row, $content) - { - $parentKey = ($row->ptable ?: 'tl_article') . '__' . $row->pid; - - if ( - isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) - && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] - && $row->type !== 'rs_columns_start' - && $row->type !== 'rs_columns_stop' - && $row->type !== 'rs_column_start' - && $row->type !== 'rs_column_stop' - ) { - - $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++; - $count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']; - - if ($count) { - - $classes = array('rs-column'); - foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) { - $classes = array_merge($classes, $media[($count - 1) % count($media)]); - if ($count - 1 < count($media)) { - $classes[] = '-' . $name . '-first-row'; - } - } - - return '
' . $content . '
'; - - } - - } - - return $content; - } - - /** - * tl_content and tl_form_field DCA onsubmit callback - * - * Creates a stop element after a start element was created - * - * @param DataContainer $dc Data container - * @return void - */ - public function onsubmitCallback($dc) + public function __invoke(DataContainer $dc): void { $activeRecord = $dc->activeRecord; if (!$activeRecord) { @@ -145,8 +74,8 @@ public function onsubmitCallback($dc) !$nextElement->type || ($activeRecord->type === 'rs_columns_start' && $nextElement->type === 'rs_column_stop') || ($activeRecord->type === 'rs_column_start' && ( - $nextElement->type === 'rs_column_start' || $nextElement->type === 'rs_columns_stop' - )) + $nextElement->type === 'rs_column_start' || $nextElement->type === 'rs_columns_stop' + )) ) { $set = array(); @@ -154,9 +83,6 @@ public function onsubmitCallback($dc) foreach ($GLOBALS['TL_DCA'][$dc->table]['fields'] as $field => $config) { if (array_key_exists('default', $config)) { $set[$field] = \is_array($config['default']) ? serialize($config['default']) : $config['default']; - if ($GLOBALS['TL_DCA'][$dc->table]['fields'][$field]['eval']['encrypt'] ?? false) { - $set[$field] = Encryption::encrypt($set[$field]); - } } } @@ -177,7 +103,6 @@ public function onsubmitCallback($dc) ->set($set) ->execute(); } - } } } diff --git a/src/Migration/ColumnsXLargeMigration.php b/src/Migration/ColumnsXLargeMigration.php new file mode 100644 index 0000000..72a3e26 --- /dev/null +++ b/src/Migration/ColumnsXLargeMigration.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\RockSolidColumns\Migration; + +use Contao\CoreBundle\Migration\AbstractMigration; +use Contao\CoreBundle\Migration\MigrationResult; +use Doctrine\DBAL\Connection; + +class ColumnsXLargeMigration extends AbstractMigration +{ + private Connection $connection; + + public function __construct(Connection $connection) + { + $this->connection = $connection; + } + + public function shouldRun(): bool + { + $schemaManager = $this->connection->createSchemaManager(); + + if (!$schemaManager->tablesExist(['tl_content'])) { + return false; + } + + $columns = $schemaManager->listTableColumns('tl_content'); + + if (!isset($columns['rs_columns_large'])) { + return false; + } + + return !isset($columns['rs_columns_xlarge']); + } + + public function run(): MigrationResult + { + $schemaManager = $this->connection->createSchemaManager(); + $columns = $schemaManager->listTableColumns('tl_content'); + + if (!isset($columns['rs_columns_xlarge'])) { + $this->connection->executeStatement("ALTER TABLE tl_content ADD rs_columns_xlarge VARCHAR(255) DEFAULT '' NOT NULL"); + $this->connection->executeStatement("UPDATE tl_content SET rs_columns_xlarge = rs_columns_large WHERE rs_columns_large != ''"); + } + + return $this->createResult(true); + } +} diff --git a/src/MadeYourDay/Contao/Model/DummyColumnsModel.php b/src/Model/DummyColumnsModel.php similarity index 63% rename from src/MadeYourDay/Contao/Model/DummyColumnsModel.php rename to src/Model/DummyColumnsModel.php index 1a96160..3443fdd 100644 --- a/src/MadeYourDay/Contao/Model/DummyColumnsModel.php +++ b/src/Model/DummyColumnsModel.php @@ -6,19 +6,22 @@ * file that was distributed with this source code. */ -namespace MadeYourDay\Contao\Model; +namespace MadeYourDay\RockSolidColumns\Model; + +use Contao\ContentModel; +use Contao\Database\Result; /** * Dummy columns model * * @author Martin Auswöger */ -class DummyColumnsModel extends \Model +class DummyColumnsModel extends ContentModel { /** * {@inheritdoc} */ - public function __construct(\Database\Result $objResult = null, $data = array()) + public function __construct(Result $objResult = null, $data = array()) { $this->arrModified = array(); $this->setRow($data); diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml new file mode 100644 index 0000000..f819815 --- /dev/null +++ b/src/Resources/config/services.yaml @@ -0,0 +1,8 @@ +services: + _defaults: + autowire: true + autoconfigure: true + + MadeYourDay\RockSolidColumns\: + resource: '../../*' + exclude: '../../{DependencyInjection,Resources}' diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 24ba456..825a996 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -12,18 +12,12 @@ * @author Martin Auswöger */ -$GLOBALS['TL_HOOKS']['generatePage'][] = array('MadeYourDay\\RockSolidColumns\\Columns', 'generatePageHook'); -$GLOBALS['TL_HOOKS']['getContentElement'][] = array('MadeYourDay\\RockSolidColumns\\Columns', 'getContentElementHook'); +use MadeYourDay\RockSolidColumns\Widget\Frontend\ColumnsWidget; -$GLOBALS['TL_CTE']['rs_columns']['rs_columns_start'] = 'MadeYourDay\\RockSolidColumns\\Element\\ColumnsStart'; -$GLOBALS['TL_CTE']['rs_columns']['rs_columns_stop'] = 'MadeYourDay\\RockSolidColumns\\Element\\ColumnsStop'; -$GLOBALS['TL_CTE']['rs_columns']['rs_column_start'] = 'MadeYourDay\\RockSolidColumns\\Element\\ColumnStart'; -$GLOBALS['TL_CTE']['rs_columns']['rs_column_stop'] = 'MadeYourDay\\RockSolidColumns\\Element\\ColumnStop'; - -$GLOBALS['TL_FFL']['rs_columns_start'] = 'MadeYourDay\\Contao\\Form\\ColumnsWidget'; -$GLOBALS['TL_FFL']['rs_columns_stop'] = 'MadeYourDay\\Contao\\Form\\ColumnsWidget'; -$GLOBALS['TL_FFL']['rs_column_start'] = 'MadeYourDay\\Contao\\Form\\ColumnsWidget'; -$GLOBALS['TL_FFL']['rs_column_stop'] = 'MadeYourDay\\Contao\\Form\\ColumnsWidget'; +$GLOBALS['TL_FFL']['rs_columns_start'] = ColumnsWidget::class; +$GLOBALS['TL_FFL']['rs_columns_stop'] = ColumnsWidget::class; +$GLOBALS['TL_FFL']['rs_column_start'] = ColumnsWidget::class; +$GLOBALS['TL_FFL']['rs_column_stop'] = ColumnsWidget::class; $GLOBALS['TL_WRAPPERS']['start'][] = 'rs_columns_start'; $GLOBALS['TL_WRAPPERS']['stop'][] = 'rs_columns_stop'; diff --git a/src/Resources/contao/dca/tl_content.php b/src/Resources/contao/dca/tl_content.php index 85030a7..a6e88d6 100644 --- a/src/Resources/contao/dca/tl_content.php +++ b/src/Resources/contao/dca/tl_content.php @@ -12,14 +12,8 @@ * @author Martin Auswöger */ +use Contao\BackendUser; use Contao\System; -use Symfony\Component\HttpFoundation\Request; - -if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) { - $GLOBALS['TL_CSS'][] = 'bundles/rocksolidcolumns/css/be_main.css'; -} - -$GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('MadeYourDay\\RockSolidColumns\\Columns', 'onsubmitCallback'); $GLOBALS['TL_DCA']['tl_content']['palettes']['rs_columns_start'] = '{type_legend},type,headline;{rs_columns_legend},rs_columns_xlarge,rs_columns_large,rs_columns_medium,rs_columns_small,rs_columns_xsmall,rs_columns_gutter,rs_columns_outside_gutters,rs_columns_equal_height;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID;{invisible_legend:hide},invisible,start,stop'; $GLOBALS['TL_DCA']['tl_content']['palettes']['rs_columns_stop'] = '{type_legend},type;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; @@ -157,7 +151,7 @@ 'exclude' => true, 'inputType' => 'imageSize', 'options_callback' => static function () { - return System::getContainer()->get('contao.image.sizes')->getAllOptions(); + return System::getContainer()->get('contao.image.sizes')->getOptionsForUser(BackendUser::getInstance()); }, 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array( diff --git a/dca/tl_form_field.php b/src/Resources/contao/dca/tl_form_field.php similarity index 90% rename from dca/tl_form_field.php rename to src/Resources/contao/dca/tl_form_field.php index 330e068..ffdf6ca 100644 --- a/dca/tl_form_field.php +++ b/src/Resources/contao/dca/tl_form_field.php @@ -12,18 +12,13 @@ * @author Martin Auswöger */ -if (TL_MODE === 'BE') { - $GLOBALS['TL_CSS'][] = 'system/modules/rocksolid-columns/assets/css/be_main.css'; - // Load content language file - $this->loadLanguageFile('tl_content'); -} +use Contao\BackendUser; +use Contao\System; -$GLOBALS['TL_DCA']['tl_form_field']['config']['onsubmit_callback'][] = array('MadeYourDay\\Contao\\Columns', 'onsubmitCallback'); - -$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_columns_start'] = '{type_legend},type;{rs_columns_legend},rs_columns_xlarge,rs_columns_large,rs_columns_medium,rs_columns_small,rs_columns_xsmall,rs_columns_gutter,rs_columns_outside_gutters,rs_columns_equal_height;{expert_legend:hide},class'; -$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_columns_stop'] = '{type_legend},type'; -$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_column_start'] = '{type_legend},type;{rs_column_background_legend},rs_column_color_inverted,rs_column_background;{expert_legend:hide},class'; -$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_column_stop'] = '{type_legend},type'; +$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_columns_start'] = '{type_legend},type;{rs_columns_legend},rs_columns_xlarge,rs_columns_large,rs_columns_medium,rs_columns_small,rs_columns_xsmall,rs_columns_gutter,rs_columns_outside_gutters,rs_columns_equal_height;{expert_legend:hide},class;{invisible_legend:hide},invisible'; +$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_columns_stop'] = '{type_legend},type;{invisible_legend:hide},invisible'; +$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_column_start'] = '{type_legend},type;{rs_column_background_legend},rs_column_color_inverted,rs_column_background;{expert_legend:hide},class;{invisible_legend:hide},invisible'; +$GLOBALS['TL_DCA']['tl_form_field']['palettes']['rs_column_stop'] = '{type_legend},type;{invisible_legend:hide},invisible'; $GLOBALS['TL_DCA']['tl_form_field']['palettes']['__selector__'][] = 'rs_column_background'; $GLOBALS['TL_DCA']['tl_form_field']['subpalettes']['rs_column_background'] = 'rs_column_background_color,rs_column_background_image,rs_column_background_image_size,rs_column_background_size,rs_column_background_position,rs_column_background_repeat'; @@ -81,7 +76,7 @@ 'reference' => &$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutters'], 'eval' => array( 'includeBlankOption' => true, - 'tl_class' => 'clr', + 'tl_class' => 'clr rs_columns_w33', ), 'sql' => "varchar(255) NOT NULL default ''", ); @@ -90,7 +85,7 @@ 'label' => &$GLOBALS['TL_LANG']['tl_content']['rs_columns_outside_gutters'], 'exclude' => true, 'eval' => array( - 'tl_class' => 'w50 m12 clr', + 'tl_class' => 'rs_columns_w33 m12', ), 'sql' => "char(1) NOT NULL default ''", ); @@ -99,7 +94,7 @@ 'label' => &$GLOBALS['TL_LANG']['tl_content']['rs_columns_equal_height'], 'exclude' => true, 'eval' => array( - 'tl_class' => 'w50 m12', + 'tl_class' => 'rs_columns_w33 m12', ), 'sql' => "char(1) NOT NULL default ''", ); @@ -147,7 +142,7 @@ 'multiple' => false, 'fieldType' => 'radio', 'filesOnly' => true, - 'extensions' => \Config::get('validImageTypes'), + 'extensions' => implode(',', System::getContainer()->getParameter('contao.image.valid_extensions')), ), 'sql' => "binary(16) NULL", ); @@ -155,7 +150,9 @@ 'label' => &$GLOBALS['TL_LANG']['tl_content']['rs_column_background_image_size'], 'exclude' => true, 'inputType' => 'imageSize', - 'options' => version_compare(VERSION, '3.4', '<') ? $GLOBALS['TL_CROP'] : System::getImageSizes(), + 'options_callback' => static function () { + return System::getContainer()->get('contao.image.sizes')->getOptionsForUser(BackendUser::getInstance()); + }, 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array( 'rgxp' => 'digit', diff --git a/src/Resources/contao/languages/de/tl_form_field.php b/src/Resources/contao/languages/de/tl_form_field.php new file mode 100644 index 0000000..7236b80 --- /dev/null +++ b/src/Resources/contao/languages/de/tl_form_field.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * RockSolid Columns category translations + * + * @author Martin Auswöger + */ + +$GLOBALS['TL_LANG']['tl_form_field']['rs_columns_legend'] = 'Spaltenkonfiguration'; +$GLOBALS['TL_LANG']['tl_form_field']['rs_column_background_legend'] = 'Hintergrund der Spalte'; diff --git a/src/Resources/contao/languages/en/tl_content.php b/src/Resources/contao/languages/en/tl_content.php index 5367749..78e9b2e 100644 --- a/src/Resources/contao/languages/en/tl_content.php +++ b/src/Resources/contao/languages/en/tl_content.php @@ -13,9 +13,46 @@ */ $GLOBALS['TL_LANG']['tl_content']['rs_columns_legend'] = 'Column configuration'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_large'][0] = 'Desktop XL columns'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_large'][1] = 'Example: 2, 3, 1-2-1, 1-3. Max. 12 cols. Explanation: The desired number of evenly distributed columns (e.g. 3) or a statement following the syntax 1-2-1 for 3 columns with a doubled middle column. Note: Per column you\'ll need one element. Single elements aren\'t split automatically.'; $GLOBALS['TL_LANG']['tl_content']['rs_columns_large'][0] = 'Desktop columns'; -$GLOBALS['TL_LANG']['tl_content']['rs_columns_large'][1] = 'Example: 2, 3, 1-2-1, 1-3. Max. 6 cols. Explanation: The desired number of evenly distributed columns (e.g. 3) or a statement following the syntax 1-2-1 for 3 columns with a doubled middle column. Note: Per column you\'ll need one element. Single elements aren\'t split automatically.'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_large'][1] = 'Example: 2, 3, 1-2-1, 1-3. Max. 12 cols. (optional)'; $GLOBALS['TL_LANG']['tl_content']['rs_columns_medium'][0] = 'Tablet columns'; $GLOBALS['TL_LANG']['tl_content']['rs_columns_medium'][1] = 'Example: 2, instead of 1-1-2 on desktop... number and distribution of the columns for visitors with smaller resolution (optional).'; $GLOBALS['TL_LANG']['tl_content']['rs_columns_small'][0] = 'Mobile columns'; $GLOBALS['TL_LANG']['tl_content']['rs_columns_small'][1] = 'Usually 1 or 2... the distribution for even smaller screens (optional, but recommended).'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_xsmall'][0] = 'Mobile XS columns'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_xsmall'][1] = 'Usually 1 or 2... the distribution for even smaller screens (optional, but recommended).'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutter'][0] = 'Columns gutter'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutter'][1] = 'Size of the gutter between the columns.'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutters']['none'] = 'None'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutters']['s'] = 'Small'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutters']['m'] = 'Medium'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutters']['l'] = 'Large'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_gutters']['h'] = 'Huge'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_outside_gutters'][0] = 'Outside gutter'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_outside_gutters'][1] = 'Inserts a space before the first and after the last column.'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_equal_height'][0] = 'Equal column height'; +$GLOBALS['TL_LANG']['tl_content']['rs_columns_equal_height'][1] = 'Creates the same height for all columns in a row.'; + +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_legend'] = 'Column background'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_color_inverted'][0] = 'Text color inverted'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_color_inverted'][1] = 'Light text color for dark backgrounds and photos.'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background'][0] = 'Enable column background'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background'][1] = 'Creates a colored background or background graphic.'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_color'][0] = 'Color'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_color'][1] = 'Color of the background. Leave this field empty for a transparent background.'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_image'][0] = 'Image'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_image'][1] = 'Background image.'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_image_size'][0] = 'Image width and height'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_image_size'][1] = 'Here you can set the dimensions of the image and the scaling mode.'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_size'][0] = 'Background size'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_size'][1] = 'Image display size.'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_sizes']['cover'] = 'Cropped'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_sizes']['contain'] = 'Proportional'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_sizes']['100% 100%'] = 'Distorted'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_sizes']['auto auto'] = 'Original size'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_position'][0] = 'Background position'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_position'][1] = 'Position of the background.'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_repeat'][0] = 'Background repeat'; +$GLOBALS['TL_LANG']['tl_content']['rs_column_background_repeat'][1] = 'Repeat mode of the background image.'; diff --git a/src/Resources/contao/languages/en/tl_form_field.php b/src/Resources/contao/languages/en/tl_form_field.php new file mode 100644 index 0000000..1c2574a --- /dev/null +++ b/src/Resources/contao/languages/en/tl_form_field.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * RockSolid Columns category translations + * + * @author Martin Auswöger + */ + +$GLOBALS['TL_LANG']['tl_form_field']['rs_columns_legend'] = 'Column configuration'; +$GLOBALS['TL_LANG']['tl_form_field']['rs_column_background_legend'] = 'Background of the column'; diff --git a/templates/form_rs_columns_plain.html5 b/src/Resources/contao/templates/form_rs_columns_plain.html5 similarity index 100% rename from templates/form_rs_columns_plain.html5 rename to src/Resources/contao/templates/form_rs_columns_plain.html5 diff --git a/src/Resources/public/css/be_main.css b/src/Resources/public/css/be_main.css index dfbab86..b57f33b 100644 --- a/src/Resources/public/css/be_main.css +++ b/src/Resources/public/css/be_main.css @@ -17,12 +17,12 @@ @media (max-width: 767px) { .rs_columns_w33, .rs_columns_w20 { - float: none; - width: calc(100% - 30px); - min-height: 0; + float: none; + width: calc(100% - 30px); + min-height: 0; } .rs_columns_w33.m12, .rs_columns_w20.m12 { - min-height: 0; + min-height: 0; } } diff --git a/src/Resources/public/css/columns.css b/src/Resources/public/css/columns.css index 737f2a4..76ba23c 100644 --- a/src/Resources/public/css/columns.css +++ b/src/Resources/public/css/columns.css @@ -314,969 +314,969 @@ } @media screen and (max-width: 1200px) { .rs-column.-xlarge-first { - clear: none; + clear: none; } .rs-column.-large-first { - clear: left; + clear: left; } .rs-column.-large-col-1-1 { - width: 100%; + width: 100%; } .rs-column.-large-col-2-1 { - width: 50%; + width: 50%; } .rs-column.-large-col-2-2 { - width: 100%; + width: 100%; } .rs-column.-large-col-3-1 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-large-col-3-2 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-large-col-3-3 { - width: 100%; + width: 100%; } .rs-column.-large-col-4-1 { - width: 25%; + width: 25%; } .rs-column.-large-col-4-2 { - width: 50%; + width: 50%; } .rs-column.-large-col-4-3 { - width: 75%; + width: 75%; } .rs-column.-large-col-4-4 { - width: 100%; + width: 100%; } .rs-column.-large-col-5-1 { - width: 20%; + width: 20%; } .rs-column.-large-col-5-2 { - width: 40%; + width: 40%; } .rs-column.-large-col-5-3 { - width: 60.0%; + width: 60.0%; } .rs-column.-large-col-5-4 { - width: 80%; + width: 80%; } .rs-column.-large-col-5-5 { - width: 100%; + width: 100%; } .rs-column.-large-col-6-1 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-large-col-6-2 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-large-col-6-3 { - width: 50%; + width: 50%; } .rs-column.-large-col-6-4 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-large-col-6-5 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-large-col-6-6 { - width: 100%; + width: 100%; } .rs-column.-large-col-7-1 { - width: 14.28571%; + width: 14.28571%; } .rs-column.-large-col-7-2 { - width: 28.57143%; + width: 28.57143%; } .rs-column.-large-col-7-3 { - width: 42.85714%; + width: 42.85714%; } .rs-column.-large-col-7-4 { - width: 57.14286%; + width: 57.14286%; } .rs-column.-large-col-7-5 { - width: 71.42857%; + width: 71.42857%; } .rs-column.-large-col-7-6 { - width: 85.71429%; + width: 85.71429%; } .rs-column.-large-col-7-7 { - width: 100%; + width: 100%; } .rs-column.-large-col-8-1 { - width: 12.5%; + width: 12.5%; } .rs-column.-large-col-8-2 { - width: 25%; + width: 25%; } .rs-column.-large-col-8-3 { - width: 37.5%; + width: 37.5%; } .rs-column.-large-col-8-4 { - width: 50%; + width: 50%; } .rs-column.-large-col-8-5 { - width: 62.5%; + width: 62.5%; } .rs-column.-large-col-8-6 { - width: 75%; + width: 75%; } .rs-column.-large-col-8-7 { - width: 87.5%; + width: 87.5%; } .rs-column.-large-col-8-8 { - width: 100%; + width: 100%; } .rs-column.-large-col-9-1 { - width: 11.11111%; + width: 11.11111%; } .rs-column.-large-col-9-2 { - width: 22.22222%; + width: 22.22222%; } .rs-column.-large-col-9-3 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-large-col-9-4 { - width: 44.44444%; + width: 44.44444%; } .rs-column.-large-col-9-5 { - width: 55.55556%; + width: 55.55556%; } .rs-column.-large-col-9-6 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-large-col-9-7 { - width: 77.77778%; + width: 77.77778%; } .rs-column.-large-col-9-8 { - width: 88.88889%; + width: 88.88889%; } .rs-column.-large-col-9-9 { - width: 100%; + width: 100%; } .rs-column.-large-col-10-1 { - width: 10%; + width: 10%; } .rs-column.-large-col-10-2 { - width: 20%; + width: 20%; } .rs-column.-large-col-10-3 { - width: 30.0%; + width: 30.0%; } .rs-column.-large-col-10-4 { - width: 40%; + width: 40%; } .rs-column.-large-col-10-5 { - width: 50%; + width: 50%; } .rs-column.-large-col-10-6 { - width: 60.0%; + width: 60.0%; } .rs-column.-large-col-10-7 { - width: 70%; + width: 70%; } .rs-column.-large-col-10-8 { - width: 80%; + width: 80%; } .rs-column.-large-col-10-9 { - width: 90%; + width: 90%; } .rs-column.-large-col-10-10 { - width: 100%; + width: 100%; } .rs-column.-large-col-11-1 { - width: 9.09091%; + width: 9.09091%; } .rs-column.-large-col-11-2 { - width: 18.18182%; + width: 18.18182%; } .rs-column.-large-col-11-3 { - width: 27.27273%; + width: 27.27273%; } .rs-column.-large-col-11-4 { - width: 36.36364%; + width: 36.36364%; } .rs-column.-large-col-11-5 { - width: 45.45455%; + width: 45.45455%; } .rs-column.-large-col-11-6 { - width: 54.54545%; + width: 54.54545%; } .rs-column.-large-col-11-7 { - width: 63.63636%; + width: 63.63636%; } .rs-column.-large-col-11-8 { - width: 72.72727%; + width: 72.72727%; } .rs-column.-large-col-11-9 { - width: 81.81818%; + width: 81.81818%; } .rs-column.-large-col-11-10 { - width: 90.90909%; + width: 90.90909%; } .rs-column.-large-col-11-11 { - width: 100%; + width: 100%; } .rs-column.-large-col-12-1 { - width: 8.33333%; + width: 8.33333%; } .rs-column.-large-col-12-2 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-large-col-12-3 { - width: 25%; + width: 25%; } .rs-column.-large-col-12-4 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-large-col-12-5 { - width: 41.66667%; + width: 41.66667%; } .rs-column.-large-col-12-6 { - width: 50%; + width: 50%; } .rs-column.-large-col-12-7 { - width: 58.33333%; + width: 58.33333%; } .rs-column.-large-col-12-8 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-large-col-12-9 { - width: 75%; + width: 75%; } .rs-column.-large-col-12-10 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-large-col-12-11 { - width: 91.66667%; + width: 91.66667%; } .rs-column.-large-col-12-12 { - width: 100%; + width: 100%; } } @media screen and (max-width: 900px) { .rs-column.-large-first { - clear: none; + clear: none; } .rs-column.-medium-first { - clear: left; + clear: left; } .rs-column.-medium-col-1-1 { - width: 100%; + width: 100%; } .rs-column.-medium-col-2-1 { - width: 50%; + width: 50%; } .rs-column.-medium-col-2-2 { - width: 100%; + width: 100%; } .rs-column.-medium-col-3-1 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-medium-col-3-2 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-medium-col-3-3 { - width: 100%; + width: 100%; } .rs-column.-medium-col-4-1 { - width: 25%; + width: 25%; } .rs-column.-medium-col-4-2 { - width: 50%; + width: 50%; } .rs-column.-medium-col-4-3 { - width: 75%; + width: 75%; } .rs-column.-medium-col-4-4 { - width: 100%; + width: 100%; } .rs-column.-medium-col-5-1 { - width: 20%; + width: 20%; } .rs-column.-medium-col-5-2 { - width: 40%; + width: 40%; } .rs-column.-medium-col-5-3 { - width: 60.0%; + width: 60.0%; } .rs-column.-medium-col-5-4 { - width: 80%; + width: 80%; } .rs-column.-medium-col-5-5 { - width: 100%; + width: 100%; } .rs-column.-medium-col-6-1 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-medium-col-6-2 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-medium-col-6-3 { - width: 50%; + width: 50%; } .rs-column.-medium-col-6-4 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-medium-col-6-5 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-medium-col-6-6 { - width: 100%; + width: 100%; } .rs-column.-medium-col-7-1 { - width: 14.28571%; + width: 14.28571%; } .rs-column.-medium-col-7-2 { - width: 28.57143%; + width: 28.57143%; } .rs-column.-medium-col-7-3 { - width: 42.85714%; + width: 42.85714%; } .rs-column.-medium-col-7-4 { - width: 57.14286%; + width: 57.14286%; } .rs-column.-medium-col-7-5 { - width: 71.42857%; + width: 71.42857%; } .rs-column.-medium-col-7-6 { - width: 85.71429%; + width: 85.71429%; } .rs-column.-medium-col-7-7 { - width: 100%; + width: 100%; } .rs-column.-medium-col-8-1 { - width: 12.5%; + width: 12.5%; } .rs-column.-medium-col-8-2 { - width: 25%; + width: 25%; } .rs-column.-medium-col-8-3 { - width: 37.5%; + width: 37.5%; } .rs-column.-medium-col-8-4 { - width: 50%; + width: 50%; } .rs-column.-medium-col-8-5 { - width: 62.5%; + width: 62.5%; } .rs-column.-medium-col-8-6 { - width: 75%; + width: 75%; } .rs-column.-medium-col-8-7 { - width: 87.5%; + width: 87.5%; } .rs-column.-medium-col-8-8 { - width: 100%; + width: 100%; } .rs-column.-medium-col-9-1 { - width: 11.11111%; + width: 11.11111%; } .rs-column.-medium-col-9-2 { - width: 22.22222%; + width: 22.22222%; } .rs-column.-medium-col-9-3 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-medium-col-9-4 { - width: 44.44444%; + width: 44.44444%; } .rs-column.-medium-col-9-5 { - width: 55.55556%; + width: 55.55556%; } .rs-column.-medium-col-9-6 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-medium-col-9-7 { - width: 77.77778%; + width: 77.77778%; } .rs-column.-medium-col-9-8 { - width: 88.88889%; + width: 88.88889%; } .rs-column.-medium-col-9-9 { - width: 100%; + width: 100%; } .rs-column.-medium-col-10-1 { - width: 10%; + width: 10%; } .rs-column.-medium-col-10-2 { - width: 20%; + width: 20%; } .rs-column.-medium-col-10-3 { - width: 30.0%; + width: 30.0%; } .rs-column.-medium-col-10-4 { - width: 40%; + width: 40%; } .rs-column.-medium-col-10-5 { - width: 50%; + width: 50%; } .rs-column.-medium-col-10-6 { - width: 60.0%; + width: 60.0%; } .rs-column.-medium-col-10-7 { - width: 70%; + width: 70%; } .rs-column.-medium-col-10-8 { - width: 80%; + width: 80%; } .rs-column.-medium-col-10-9 { - width: 90%; + width: 90%; } .rs-column.-medium-col-10-10 { - width: 100%; + width: 100%; } .rs-column.-medium-col-11-1 { - width: 9.09091%; + width: 9.09091%; } .rs-column.-medium-col-11-2 { - width: 18.18182%; + width: 18.18182%; } .rs-column.-medium-col-11-3 { - width: 27.27273%; + width: 27.27273%; } .rs-column.-medium-col-11-4 { - width: 36.36364%; + width: 36.36364%; } .rs-column.-medium-col-11-5 { - width: 45.45455%; + width: 45.45455%; } .rs-column.-medium-col-11-6 { - width: 54.54545%; + width: 54.54545%; } .rs-column.-medium-col-11-7 { - width: 63.63636%; + width: 63.63636%; } .rs-column.-medium-col-11-8 { - width: 72.72727%; + width: 72.72727%; } .rs-column.-medium-col-11-9 { - width: 81.81818%; + width: 81.81818%; } .rs-column.-medium-col-11-10 { - width: 90.90909%; + width: 90.90909%; } .rs-column.-medium-col-11-11 { - width: 100%; + width: 100%; } .rs-column.-medium-col-12-1 { - width: 8.33333%; + width: 8.33333%; } .rs-column.-medium-col-12-2 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-medium-col-12-3 { - width: 25%; + width: 25%; } .rs-column.-medium-col-12-4 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-medium-col-12-5 { - width: 41.66667%; + width: 41.66667%; } .rs-column.-medium-col-12-6 { - width: 50%; + width: 50%; } .rs-column.-medium-col-12-7 { - width: 58.33333%; + width: 58.33333%; } .rs-column.-medium-col-12-8 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-medium-col-12-9 { - width: 75%; + width: 75%; } .rs-column.-medium-col-12-10 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-medium-col-12-11 { - width: 91.66667%; + width: 91.66667%; } .rs-column.-medium-col-12-12 { - width: 100%; + width: 100%; } } @media screen and (max-width: 599px) { .rs-column.-medium-first { - clear: none; + clear: none; } .rs-column.-small-first { - clear: left; + clear: left; } .rs-column.-small-col-1-1 { - width: 100%; + width: 100%; } .rs-column.-small-col-2-1 { - width: 50%; + width: 50%; } .rs-column.-small-col-2-2 { - width: 100%; + width: 100%; } .rs-column.-small-col-3-1 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-small-col-3-2 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-small-col-3-3 { - width: 100%; + width: 100%; } .rs-column.-small-col-4-1 { - width: 25%; + width: 25%; } .rs-column.-small-col-4-2 { - width: 50%; + width: 50%; } .rs-column.-small-col-4-3 { - width: 75%; + width: 75%; } .rs-column.-small-col-4-4 { - width: 100%; + width: 100%; } .rs-column.-small-col-5-1 { - width: 20%; + width: 20%; } .rs-column.-small-col-5-2 { - width: 40%; + width: 40%; } .rs-column.-small-col-5-3 { - width: 60.0%; + width: 60.0%; } .rs-column.-small-col-5-4 { - width: 80%; + width: 80%; } .rs-column.-small-col-5-5 { - width: 100%; + width: 100%; } .rs-column.-small-col-6-1 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-small-col-6-2 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-small-col-6-3 { - width: 50%; + width: 50%; } .rs-column.-small-col-6-4 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-small-col-6-5 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-small-col-6-6 { - width: 100%; + width: 100%; } .rs-column.-small-col-7-1 { - width: 14.28571%; + width: 14.28571%; } .rs-column.-small-col-7-2 { - width: 28.57143%; + width: 28.57143%; } .rs-column.-small-col-7-3 { - width: 42.85714%; + width: 42.85714%; } .rs-column.-small-col-7-4 { - width: 57.14286%; + width: 57.14286%; } .rs-column.-small-col-7-5 { - width: 71.42857%; + width: 71.42857%; } .rs-column.-small-col-7-6 { - width: 85.71429%; + width: 85.71429%; } .rs-column.-small-col-7-7 { - width: 100%; + width: 100%; } .rs-column.-small-col-8-1 { - width: 12.5%; + width: 12.5%; } .rs-column.-small-col-8-2 { - width: 25%; + width: 25%; } .rs-column.-small-col-8-3 { - width: 37.5%; + width: 37.5%; } .rs-column.-small-col-8-4 { - width: 50%; + width: 50%; } .rs-column.-small-col-8-5 { - width: 62.5%; + width: 62.5%; } .rs-column.-small-col-8-6 { - width: 75%; + width: 75%; } .rs-column.-small-col-8-7 { - width: 87.5%; + width: 87.5%; } .rs-column.-small-col-8-8 { - width: 100%; + width: 100%; } .rs-column.-small-col-9-1 { - width: 11.11111%; + width: 11.11111%; } .rs-column.-small-col-9-2 { - width: 22.22222%; + width: 22.22222%; } .rs-column.-small-col-9-3 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-small-col-9-4 { - width: 44.44444%; + width: 44.44444%; } .rs-column.-small-col-9-5 { - width: 55.55556%; + width: 55.55556%; } .rs-column.-small-col-9-6 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-small-col-9-7 { - width: 77.77778%; + width: 77.77778%; } .rs-column.-small-col-9-8 { - width: 88.88889%; + width: 88.88889%; } .rs-column.-small-col-9-9 { - width: 100%; + width: 100%; } .rs-column.-small-col-10-1 { - width: 10%; + width: 10%; } .rs-column.-small-col-10-2 { - width: 20%; + width: 20%; } .rs-column.-small-col-10-3 { - width: 30.0%; + width: 30.0%; } .rs-column.-small-col-10-4 { - width: 40%; + width: 40%; } .rs-column.-small-col-10-5 { - width: 50%; + width: 50%; } .rs-column.-small-col-10-6 { - width: 60.0%; + width: 60.0%; } .rs-column.-small-col-10-7 { - width: 70%; + width: 70%; } .rs-column.-small-col-10-8 { - width: 80%; + width: 80%; } .rs-column.-small-col-10-9 { - width: 90%; + width: 90%; } .rs-column.-small-col-10-10 { - width: 100%; + width: 100%; } .rs-column.-small-col-11-1 { - width: 9.09091%; + width: 9.09091%; } .rs-column.-small-col-11-2 { - width: 18.18182%; + width: 18.18182%; } .rs-column.-small-col-11-3 { - width: 27.27273%; + width: 27.27273%; } .rs-column.-small-col-11-4 { - width: 36.36364%; + width: 36.36364%; } .rs-column.-small-col-11-5 { - width: 45.45455%; + width: 45.45455%; } .rs-column.-small-col-11-6 { - width: 54.54545%; + width: 54.54545%; } .rs-column.-small-col-11-7 { - width: 63.63636%; + width: 63.63636%; } .rs-column.-small-col-11-8 { - width: 72.72727%; + width: 72.72727%; } .rs-column.-small-col-11-9 { - width: 81.81818%; + width: 81.81818%; } .rs-column.-small-col-11-10 { - width: 90.90909%; + width: 90.90909%; } .rs-column.-small-col-11-11 { - width: 100%; + width: 100%; } .rs-column.-small-col-12-1 { - width: 8.33333%; + width: 8.33333%; } .rs-column.-small-col-12-2 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-small-col-12-3 { - width: 25%; + width: 25%; } .rs-column.-small-col-12-4 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-small-col-12-5 { - width: 41.66667%; + width: 41.66667%; } .rs-column.-small-col-12-6 { - width: 50%; + width: 50%; } .rs-column.-small-col-12-7 { - width: 58.33333%; + width: 58.33333%; } .rs-column.-small-col-12-8 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-small-col-12-9 { - width: 75%; + width: 75%; } .rs-column.-small-col-12-10 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-small-col-12-11 { - width: 91.66667%; + width: 91.66667%; } .rs-column.-small-col-12-12 { - width: 100%; + width: 100%; } } @media screen and (max-width: 399px) { .rs-column.-small-first { - clear: none; + clear: none; } .rs-column.-xsmall-first { - clear: left; + clear: left; } .rs-column.-xsmall-col-1-1 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-2-1 { - width: 50%; + width: 50%; } .rs-column.-xsmall-col-2-2 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-3-1 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-xsmall-col-3-2 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-xsmall-col-3-3 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-4-1 { - width: 25%; + width: 25%; } .rs-column.-xsmall-col-4-2 { - width: 50%; + width: 50%; } .rs-column.-xsmall-col-4-3 { - width: 75%; + width: 75%; } .rs-column.-xsmall-col-4-4 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-5-1 { - width: 20%; + width: 20%; } .rs-column.-xsmall-col-5-2 { - width: 40%; + width: 40%; } .rs-column.-xsmall-col-5-3 { - width: 60.0%; + width: 60.0%; } .rs-column.-xsmall-col-5-4 { - width: 80%; + width: 80%; } .rs-column.-xsmall-col-5-5 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-6-1 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-xsmall-col-6-2 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-xsmall-col-6-3 { - width: 50%; + width: 50%; } .rs-column.-xsmall-col-6-4 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-xsmall-col-6-5 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-xsmall-col-6-6 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-7-1 { - width: 14.28571%; + width: 14.28571%; } .rs-column.-xsmall-col-7-2 { - width: 28.57143%; + width: 28.57143%; } .rs-column.-xsmall-col-7-3 { - width: 42.85714%; + width: 42.85714%; } .rs-column.-xsmall-col-7-4 { - width: 57.14286%; + width: 57.14286%; } .rs-column.-xsmall-col-7-5 { - width: 71.42857%; + width: 71.42857%; } .rs-column.-xsmall-col-7-6 { - width: 85.71429%; + width: 85.71429%; } .rs-column.-xsmall-col-7-7 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-8-1 { - width: 12.5%; + width: 12.5%; } .rs-column.-xsmall-col-8-2 { - width: 25%; + width: 25%; } .rs-column.-xsmall-col-8-3 { - width: 37.5%; + width: 37.5%; } .rs-column.-xsmall-col-8-4 { - width: 50%; + width: 50%; } .rs-column.-xsmall-col-8-5 { - width: 62.5%; + width: 62.5%; } .rs-column.-xsmall-col-8-6 { - width: 75%; + width: 75%; } .rs-column.-xsmall-col-8-7 { - width: 87.5%; + width: 87.5%; } .rs-column.-xsmall-col-8-8 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-9-1 { - width: 11.11111%; + width: 11.11111%; } .rs-column.-xsmall-col-9-2 { - width: 22.22222%; + width: 22.22222%; } .rs-column.-xsmall-col-9-3 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-xsmall-col-9-4 { - width: 44.44444%; + width: 44.44444%; } .rs-column.-xsmall-col-9-5 { - width: 55.55556%; + width: 55.55556%; } .rs-column.-xsmall-col-9-6 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-xsmall-col-9-7 { - width: 77.77778%; + width: 77.77778%; } .rs-column.-xsmall-col-9-8 { - width: 88.88889%; + width: 88.88889%; } .rs-column.-xsmall-col-9-9 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-10-1 { - width: 10%; + width: 10%; } .rs-column.-xsmall-col-10-2 { - width: 20%; + width: 20%; } .rs-column.-xsmall-col-10-3 { - width: 30.0%; + width: 30.0%; } .rs-column.-xsmall-col-10-4 { - width: 40%; + width: 40%; } .rs-column.-xsmall-col-10-5 { - width: 50%; + width: 50%; } .rs-column.-xsmall-col-10-6 { - width: 60.0%; + width: 60.0%; } .rs-column.-xsmall-col-10-7 { - width: 70%; + width: 70%; } .rs-column.-xsmall-col-10-8 { - width: 80%; + width: 80%; } .rs-column.-xsmall-col-10-9 { - width: 90%; + width: 90%; } .rs-column.-xsmall-col-10-10 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-11-1 { - width: 9.09091%; + width: 9.09091%; } .rs-column.-xsmall-col-11-2 { - width: 18.18182%; + width: 18.18182%; } .rs-column.-xsmall-col-11-3 { - width: 27.27273%; + width: 27.27273%; } .rs-column.-xsmall-col-11-4 { - width: 36.36364%; + width: 36.36364%; } .rs-column.-xsmall-col-11-5 { - width: 45.45455%; + width: 45.45455%; } .rs-column.-xsmall-col-11-6 { - width: 54.54545%; + width: 54.54545%; } .rs-column.-xsmall-col-11-7 { - width: 63.63636%; + width: 63.63636%; } .rs-column.-xsmall-col-11-8 { - width: 72.72727%; + width: 72.72727%; } .rs-column.-xsmall-col-11-9 { - width: 81.81818%; + width: 81.81818%; } .rs-column.-xsmall-col-11-10 { - width: 90.90909%; + width: 90.90909%; } .rs-column.-xsmall-col-11-11 { - width: 100%; + width: 100%; } .rs-column.-xsmall-col-12-1 { - width: 8.33333%; + width: 8.33333%; } .rs-column.-xsmall-col-12-2 { - width: 16.66667%; + width: 16.66667%; } .rs-column.-xsmall-col-12-3 { - width: 25%; + width: 25%; } .rs-column.-xsmall-col-12-4 { - width: 33.33333%; + width: 33.33333%; } .rs-column.-xsmall-col-12-5 { - width: 41.66667%; + width: 41.66667%; } .rs-column.-xsmall-col-12-6 { - width: 50%; + width: 50%; } .rs-column.-xsmall-col-12-7 { - width: 58.33333%; + width: 58.33333%; } .rs-column.-xsmall-col-12-8 { - width: 66.66667%; + width: 66.66667%; } .rs-column.-xsmall-col-12-9 { - width: 75%; + width: 75%; } .rs-column.-xsmall-col-12-10 { - width: 83.33333%; + width: 83.33333%; } .rs-column.-xsmall-col-12-11 { - width: 91.66667%; + width: 91.66667%; } .rs-column.-xsmall-col-12-12 { - width: 100%; + width: 100%; } } diff --git a/src/MadeYourDay/Contao/Form/ColumnsWidget.php b/src/Widget/Frontend/ColumnsWidget.php similarity index 74% rename from src/MadeYourDay/Contao/Form/ColumnsWidget.php rename to src/Widget/Frontend/ColumnsWidget.php index edf447a..67276a1 100644 --- a/src/MadeYourDay/Contao/Form/ColumnsWidget.php +++ b/src/Widget/Frontend/ColumnsWidget.php @@ -6,17 +6,18 @@ * file that was distributed with this source code. */ -namespace MadeYourDay\Contao\Form; +namespace MadeYourDay\RockSolidColumns\Widget\Frontend; -use MadeYourDay\Contao\Model\DummyColumnsModel; -use MadeYourDay\Contao\Columns; +use Contao\ContentElement; +use Contao\Widget; +use MadeYourDay\RockSolidColumns\Model\DummyColumnsModel; /** * Custom form widget * * @author Martin Auswöger */ -class ColumnsWidget extends \Widget +class ColumnsWidget extends Widget { /** * @var string Template @@ -24,7 +25,7 @@ class ColumnsWidget extends \Widget protected $strTemplate = 'form_rs_columns_plain'; /** - * @var \ContentElement + * @var ContentElement */ private $contentElement; @@ -37,7 +38,9 @@ public function __construct($data = null) $data['cssID'] = serialize(array('', $data['class'])); } - $class = \ContentElement::findClass($data['type']); + $data['ptable'] = 'tl_form'; + + $class = ContentElement::findClass($data['type']); $this->contentElement = new $class(new DummyColumnsModel(null, $data));