From 63a798309d8612afccf74c5c30ba9147fdd9fddb Mon Sep 17 00:00:00 2001 From: ebremner <ebremner@uwaterloo.ca> Date: Mon, 14 Sep 2020 09:53:28 -0400 Subject: [PATCH] ISTWCMS-4084: adding inverted L right layout --- src/Plugin/Layout/UwInvertedLRightLayout.php | 38 ++++++++++++++++++++ uw_cfg_common.layouts.yml | 20 ++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/Plugin/Layout/UwInvertedLRightLayout.php diff --git a/src/Plugin/Layout/UwInvertedLRightLayout.php b/src/Plugin/Layout/UwInvertedLRightLayout.php new file mode 100644 index 00000000..e0bd1f7a --- /dev/null +++ b/src/Plugin/Layout/UwInvertedLRightLayout.php @@ -0,0 +1,38 @@ +<?php + +namespace Drupal\uw_cfg_common\Plugin\Layout; + +use Drupal\Core\Form\FormStateInterface; + +/** + * A UW Inverted L Right layout. + */ +class UwInvertedLRightLayout extends UwColumnLayoutBase { + + /** + * {@inheritdoc} + */ + public function buildConfigurationForm(array $form, FormStateInterface $form_state) { + + // Get the config for this layout. + $configuration = $this->getConfiguration(); + + // The options for the column widths. + $options = [ + 'even-split' => $this->t('Even split (50%, 50%)'), + 'larger-left' => $this->t('Larger left (33%, 67%)'), + 'larger-right' => $this->t('Larger right (67%, 33%)'), + ]; + + // The form element for the column widths. + $form['layout_settings']['column_class'] = [ + '#type' => 'select', + '#title' => $this->t('Column widths for top row'), + '#default_value' => !empty($configuration['column_class']) ? $configuration['column_class'] : 'even-split', + '#options' => $options, + ]; + + return $form; + } + +} diff --git a/uw_cfg_common.layouts.yml b/uw_cfg_common.layouts.yml index 2b84869c..8b3ebe34 100644 --- a/uw_cfg_common.layouts.yml +++ b/uw_cfg_common.layouts.yml @@ -71,4 +71,22 @@ uw_five_column: fifth: label: Fifth icon_map: - - [first, second, third, fourth, fifth] \ No newline at end of file + - [first, second, third, fourth, fifth] +uw_inverted_l_right: + label: 'Inverted "L" - right' + category: 'UW layouts' + class: '\Drupal\uw_cfg_common\Plugin\Layout\UwInvertedLRightLayout' + template: uw_fdsu_theme_resp/templates/layout/layout--invertedlright + default_region: first + regions: + first: + label: First + second: + label: Second + third: + label: Third + fourth: + label: Fourth + icon_map: + - [first, second, fourth] + - [third, third, fourth] \ No newline at end of file -- GitLab