diff --git a/web/themes/contrib/civictheme/civictheme.theme b/web/themes/contrib/civictheme/civictheme.theme index fef1ef8fa..080911fdb 100644 --- a/web/themes/contrib/civictheme/civictheme.theme +++ b/web/themes/contrib/civictheme/civictheme.theme @@ -27,6 +27,7 @@ require_once __DIR__ . '/includes/iframe.inc'; require_once __DIR__ . '/includes/image.inc'; require_once __DIR__ . '/includes/link.inc'; require_once __DIR__ . '/includes/automated_list.inc'; +require_once __DIR__ . '/includes/layout.inc'; require_once __DIR__ . '/includes/local_tasks.inc'; require_once __DIR__ . '/includes/libraries.inc'; require_once __DIR__ . '/includes/map.inc'; diff --git a/web/themes/contrib/civictheme/includes/layout.inc b/web/themes/contrib/civictheme/includes/layout.inc new file mode 100644 index 000000000..b21a002ec --- /dev/null +++ b/web/themes/contrib/civictheme/includes/layout.inc @@ -0,0 +1,16 @@ + $this->t('Check if the layout elements should be contained. Leave unchecked for edge-to-edge width. If sidebar regions are present - the layout will be contained regardless of this setting.'), ]; + $form['vertical_spacing'] = [ + '#type' => 'select', + '#title' => $this->t('Vertical spacing'), + '#default_value' => $this->configuration['vertical_spacing'], + '#options' => [ + 'none' => $this->t('None'), + 'top' => $this->t('Top'), + 'bottom' => $this->t('Bottom'), + 'both' => $this->t('Both'), + 'auto' => $this->t('Automatic'), + ], + ]; + return parent::buildConfigurationForm($form, $form_state); } @@ -37,6 +50,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { parent::submitConfigurationForm($form, $form_state); $this->configuration['is_contained'] = $form_state->getValue('is_contained'); + $this->configuration['vertical_spacing'] = $form_state->getValue('vertical_spacing'); } } diff --git a/web/themes/contrib/civictheme/templates/layout/layout--three-columns.html.twig b/web/themes/contrib/civictheme/templates/layout/layout--three-columns.html.twig index 7b5217aba..f6f414016 100644 --- a/web/themes/contrib/civictheme/templates/layout/layout--three-columns.html.twig +++ b/web/themes/contrib/civictheme/templates/layout/layout--three-columns.html.twig @@ -28,10 +28,9 @@ {% set has_sidebar_left = (content.sidebar_top_left is not empty or content.sidebar_bottom_left is not empty) and not hide_sidebar_left|default(false) %} {% set has_sidebar_right = (content.sidebar_top_right is not empty or content.sidebar_bottom_right is not empty) and not hide_sidebar_right|default(false) %} -{% set is_contained = settings.is_contained %} {% set is_contained = is_contained or has_sidebar_left or has_sidebar_right %} -{% set vertical_spacing = has_sidebar_left or has_sidebar_right ? 'top' : vertical_spacing %} +{% set vertical_spacing = vertical_spacing != 'auto' ? vertical_spacing : has_sidebar_left or has_sidebar_right ? 'top' : '' %} {% set no_sidebar_left_class = hide_sidebar_left ? 'ct-layout--no-sidebar-left' : '' %} {% set no_sidebar_right_class = hide_sidebar_right ? 'ct-layout--no-sidebar-right' : '' %}