From afd7374c96a02f9d96eea87288d72cd704e315b8 Mon Sep 17 00:00:00 2001 From: nJim Date: Thu, 3 Aug 2023 10:03:08 -0400 Subject: [PATCH 01/88] fix: updating to latest atomic --- web/profiles/custom/yalesites_profile/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index 6ea6c30a80..5c6088534a 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -81,7 +81,7 @@ "drupal/upgrade_status": "^3.18", "drupal/webform": "^6.2@beta", "drupal/wingsuit_companion": "^2.0@RC", - "yalesites-org/atomic": "1.16.3", + "yalesites-org/atomic": "1.17.0", "oomphinc/composer-installers-extender": "^2.0", "wikimedia/composer-merge-plugin": "^2.1", "yalesites-org/yale_cas": "^1.0" From 5aa024b685c505336701f89ccbee50c27a117c27 Mon Sep 17 00:00:00 2001 From: nJim Date: Thu, 3 Aug 2023 23:51:13 -0400 Subject: [PATCH 02/88] hotfix: downgrade captcha module --- web/profiles/custom/yalesites_profile/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index 5c6088534a..5e238d8aba 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -16,7 +16,7 @@ "drupal/block_content_permissions": "^1.11", "drupal/bugherd": "1.0", "drupal/calendar_link": "^3.0", - "drupal/captcha": "^1.8", + "drupal/captcha": "1.10.0", "drupal/cas": "^2.0", "drupal/chosen": "^4.0", "drupal/components": "^3.0", From 3cfefe782231fcdffef2cc0fa678c41f5f0cf7b2 Mon Sep 17 00:00:00 2001 From: nJim Date: Fri, 4 Aug 2023 00:01:54 -0400 Subject: [PATCH 03/88] hotfix: remove view/argument warnings --- .../custom/ys_views_basic/src/ViewsBasicManager.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index 7e84e5d261..16b7ec373e 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -179,7 +179,7 @@ public function getView($type, $params) { } // Set operator: "+" is "OR" and "," is "AND". - $operator = $paramsDecoded['operator'] ?: '+'; + $operator = !empty($paramsDecoded['operator']) ?: '+'; $termsInclude = isset($termsIncludeArray) ? implode($operator, $termsIncludeArray) : 'all'; $termsExclude = isset($termsExcludeArray) ? implode($operator, $termsExcludeArray) : NULL; @@ -192,6 +192,14 @@ public function getView($type, $params) { $itemsLimit = $paramsDecoded['limit']; } + $timePeriod = NULL; + if ( + str_contains($filterType, 'event') && + !empty($paramsDecoded['filters']['event_time_period']) + ) { + $timePeriod = $paramsDecoded['filters']['event_time_period']; + } + $view->setArguments( [ 'type' => $filterType, @@ -200,7 +208,7 @@ public function getView($type, $params) { 'sort' => $paramsDecoded['sort_by'], 'view' => $paramsDecoded['view_mode'], 'items' => $itemsLimit, - 'event_time_period' => str_contains($filterType, 'event') ? $paramsDecoded['filters']['event_time_period'] : NULL, + 'event_time_period' => $timePeriod, ] ); From 5a66c407b5cca495e6455282cee8c92fcf95b9c2 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 3 Aug 2023 16:49:01 -0700 Subject: [PATCH 04/88] fix: Adds checks to certain views basic variables to prevent errors in logs --- .../src/Plugin/views/style/ViewsBasicDynamicStyle.php | 4 +--- .../modules/custom/ys_views_basic/src/ViewsBasicManager.php | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php index 5713091e23..5fe55f868c 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/views/style/ViewsBasicDynamicStyle.php @@ -121,9 +121,7 @@ public function render() { // Get node type to pass to template to determine width. $entity = $this->routeMatch->getParameter('node'); - if ($entity) { - $parentNode = $entity->getType(); - } + $parentNode = isset($entity) ? $entity->getType() : NULL; return [ '#theme' => 'views_basic_rows', diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index 7e84e5d261..60e6f3efb8 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -179,7 +179,7 @@ public function getView($type, $params) { } // Set operator: "+" is "OR" and "," is "AND". - $operator = $paramsDecoded['operator'] ?: '+'; + $operator = isset($paramsDecoded['operator']) ?: '+'; $termsInclude = isset($termsIncludeArray) ? implode($operator, $termsIncludeArray) : 'all'; $termsExclude = isset($termsExcludeArray) ? implode($operator, $termsExcludeArray) : NULL; @@ -192,6 +192,8 @@ public function getView($type, $params) { $itemsLimit = $paramsDecoded['limit']; } + $eventTimePeriod = isset($paramsDecoded['filters']['event_time_period']) ? $paramsDecoded['filters']['event_time_period'] : NULL; + $view->setArguments( [ 'type' => $filterType, @@ -200,7 +202,7 @@ public function getView($type, $params) { 'sort' => $paramsDecoded['sort_by'], 'view' => $paramsDecoded['view_mode'], 'items' => $itemsLimit, - 'event_time_period' => str_contains($filterType, 'event') ? $paramsDecoded['filters']['event_time_period'] : NULL, + 'event_time_period' => str_contains($filterType, 'event') ? $eventTimePeriod : NULL, ] ); From 5d353e28a14562d32cf014a673c355c96a7ad904 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 3 Aug 2023 16:54:03 -0700 Subject: [PATCH 05/88] fix: don't return boolean, instead return actual operator value --- .../modules/custom/ys_views_basic/src/ViewsBasicManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index 60e6f3efb8..cd21cf8d64 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -179,7 +179,7 @@ public function getView($type, $params) { } // Set operator: "+" is "OR" and "," is "AND". - $operator = isset($paramsDecoded['operator']) ?: '+'; + $operator = isset($paramsDecoded['operator']) ? $paramsDecoded['operator'] : '+'; $termsInclude = isset($termsIncludeArray) ? implode($operator, $termsIncludeArray) : 'all'; $termsExclude = isset($termsExcludeArray) ? implode($operator, $termsExcludeArray) : NULL; From ebf23a3c625bf4a169f12028fc9bb8343d812c56 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 3 Aug 2023 17:19:54 -0700 Subject: [PATCH 06/88] fix: Change to null coalescing operator --- .../modules/custom/ys_views_basic/src/ViewsBasicManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index cd21cf8d64..239d6de6f5 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -179,7 +179,7 @@ public function getView($type, $params) { } // Set operator: "+" is "OR" and "," is "AND". - $operator = isset($paramsDecoded['operator']) ? $paramsDecoded['operator'] : '+'; + $operator = $paramsDecoded['operator'] ?? '+'; $termsInclude = isset($termsIncludeArray) ? implode($operator, $termsIncludeArray) : 'all'; $termsExclude = isset($termsExcludeArray) ? implode($operator, $termsExcludeArray) : NULL; @@ -192,7 +192,7 @@ public function getView($type, $params) { $itemsLimit = $paramsDecoded['limit']; } - $eventTimePeriod = isset($paramsDecoded['filters']['event_time_period']) ? $paramsDecoded['filters']['event_time_period'] : NULL; + $eventTimePeriod = $paramsDecoded['filters']['event_time_period'] ?? NULL; $view->setArguments( [ From 78a2bb133700fbd3116c2aa4e4e3876698cef796 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 4 Aug 2023 10:49:23 -0700 Subject: [PATCH 07/88] fix: fix incorrect target ID for filtering --- .../modules/custom/ys_views_basic/src/ViewsBasicManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index 239d6de6f5..9724f39f6e 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -167,14 +167,14 @@ public function getView($type, $params) { // Get terms to include. if (isset($paramsDecoded['filters']['terms_include'])) { foreach ($paramsDecoded['filters']['terms_include'] as $term) { - $termsIncludeArray[] = (int) $term; + $termsIncludeArray[] = (int) $term['target_id']; } } // Get terms to exclude. if (isset($paramsDecoded['filters']['terms_exclude'])) { foreach ($paramsDecoded['filters']['terms_exclude'] as $term) { - $termsExcludeArray[] = (int) $term; + $termsExcludeArray[] = (int) $term['target_id']; } } From c96484830ef144644b81b8ba77ca266b18290020 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 4 Aug 2023 11:11:02 -0700 Subject: [PATCH 08/88] fix: Account for backwards compatibility with older stored values prior to chosen --- .../modules/custom/ys_views_basic/src/ViewsBasicManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index 9724f39f6e..6a538c1851 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -167,14 +167,14 @@ public function getView($type, $params) { // Get terms to include. if (isset($paramsDecoded['filters']['terms_include'])) { foreach ($paramsDecoded['filters']['terms_include'] as $term) { - $termsIncludeArray[] = (int) $term['target_id']; + $termsIncludeArray[] = (int) is_object($term) ? $term['target_id'] : $term; } } // Get terms to exclude. if (isset($paramsDecoded['filters']['terms_exclude'])) { foreach ($paramsDecoded['filters']['terms_exclude'] as $term) { - $termsExcludeArray[] = (int) $term['target_id']; + $termsExcludeArray[] = (int) is_object($term) ? $term['target_id'] : $term; } } From b56747ea1ecea95c1aa18cba09b91489d78db8f3 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 4 Aug 2023 11:59:08 -0700 Subject: [PATCH 09/88] fix: Check if terms arrays are arrays first --- .../modules/custom/ys_views_basic/src/ViewsBasicManager.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index 6a538c1851..162f847486 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -180,8 +180,9 @@ public function getView($type, $params) { // Set operator: "+" is "OR" and "," is "AND". $operator = $paramsDecoded['operator'] ?? '+'; - $termsInclude = isset($termsIncludeArray) ? implode($operator, $termsIncludeArray) : 'all'; - $termsExclude = isset($termsExcludeArray) ? implode($operator, $termsExcludeArray) : NULL; + + $termsInclude = (isset($termsIncludeArray) && is_array($termsIncludeArray)) ? implode($operator, $termsIncludeArray) : 'all'; + $termsExclude = (isset($termsExcludeArray) && is_array($termsExcludeArray)) ? implode($operator, $termsExcludeArray) : NULL; if ( ($type == 'count' && $paramsDecoded['display'] != 'limit') || From 584a9b24686b019e139c1609304490349a429ae1 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 4 Aug 2023 12:49:10 -0700 Subject: [PATCH 10/88] fix: Additional checks to prevent errors in logs --- .../modules/custom/ys_views_basic/src/ViewsBasicManager.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php index 162f847486..82c8f9cde9 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/ViewsBasicManager.php @@ -163,6 +163,8 @@ public function getView($type, $params) { */ $filterType = implode('+', $paramsDecoded['filters']['types']); + $termsIncludeArray = []; + $termsExcludeArray = []; // Get terms to include. if (isset($paramsDecoded['filters']['terms_include'])) { @@ -181,8 +183,8 @@ public function getView($type, $params) { // Set operator: "+" is "OR" and "," is "AND". $operator = $paramsDecoded['operator'] ?? '+'; - $termsInclude = (isset($termsIncludeArray) && is_array($termsIncludeArray)) ? implode($operator, $termsIncludeArray) : 'all'; - $termsExclude = (isset($termsExcludeArray) && is_array($termsExcludeArray)) ? implode($operator, $termsExcludeArray) : NULL; + $termsInclude = (count($termsIncludeArray) != 0) ? implode($operator, $termsIncludeArray) : 'all'; + $termsExclude = (count($termsExcludeArray) != 0) ? implode($operator, $termsExcludeArray) : NULL; if ( ($type == 'count' && $paramsDecoded['display'] != 'limit') || From 340d70658bdd3e35921d95ba90a3f616b1b99850 Mon Sep 17 00:00:00 2001 From: David Blankenship Date: Tue, 8 Aug 2023 15:38:15 -0400 Subject: [PATCH 11/88] revert(chosen): remove composer-merge-plugin Due to an issue with Pantheon and the now deprecated use of composer-merge-plugin, we are removing references to it's use in order to provide another fix for this. References: - https://www.drupal.org/node/3069730 - https://git.drupalcode.org/project/chosen/-/blob/4.0.x/README.txt --- composer.json | 13 +------------ web/profiles/custom/yalesites_profile/composer.json | 12 +----------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/composer.json b/composer.json index cc7e2021a2..b73f9cbd8f 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,6 @@ "drupal/core-recommended": "^9.2", "drush/drush": "^11 || ^12", "pantheon-systems/drupal-integrations": "^9", - "wikimedia/composer-merge-plugin": "^2.1", "yalesites-org/yalesites_profile": "*" }, "require-dev": { @@ -94,14 +93,6 @@ "composer-exit-on-patch-failure": true, "patchLevel": { "drupal/core": "-p2" - }, - "allow-plugins": { - "JJJ/chosen": true - }, - "merge-plugin": { - "include": [ - "web/modules/contrib/chosen/composer.libraries.json" - ] } }, "config": { @@ -115,9 +106,7 @@ "composer/installers": true, "cweagans/composer-patches": true, "drupal/core-composer-scaffold": true, - "drupal/console-extend-plugin": true, - "wikimedia/composer-merge-plugin": true, - "oomphinc/composer-installers-extender": true + "drupal/console-extend-plugin": true } }, "scripts": { diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index 5e238d8aba..a2e583b759 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -82,19 +82,12 @@ "drupal/webform": "^6.2@beta", "drupal/wingsuit_companion": "^2.0@RC", "yalesites-org/atomic": "1.17.0", - "oomphinc/composer-installers-extender": "^2.0", - "wikimedia/composer-merge-plugin": "^2.1", "yalesites-org/yale_cas": "^1.0" }, "minimum-stability": "dev", "prefer-stable": true, "config": { - "sort-packages": true, - "allow-plugins": { - "composer/installers": true, - "oomphinc/composer-installers-extender": true, - "wikimedia/composer-merge-plugin": true - } + "sort-packages": true }, "extra": { "enable-patching": true, @@ -102,9 +95,6 @@ "patchLevel": { "drupal/core": "-p2" }, - "installer-paths": { - "../../../../web/core": ["type:drupal-core"] - }, "patches": { "drupal/layout_paragraphs": { "save close tweaks": "https://git.drupalcode.org/project/layout_paragraphs/-/merge_requests/80.patch" From 2aef510fb2dc77e413bacfa28312ecbfc58c0ef2 Mon Sep 17 00:00:00 2001 From: David Blankenship Date: Tue, 8 Aug 2023 15:48:01 -0400 Subject: [PATCH 12/88] fix(chosen): use installer-plugin to place chosenJS In order for chosen to work in Drupal, it must reside in ./web/libraries/chosen. This allows composer to utilize the installer-paths to accomplish this. Co-authoried-by: @vinmassaro --- composer.json | 8 +++++++- web/profiles/custom/yalesites_profile/composer.json | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b73f9cbd8f..9596e909a0 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "drupal/core-composer-scaffold": "^9.2", "drupal/core-recommended": "^9.2", "drush/drush": "^11 || ^12", + "oomphinc/composer-installers-extender": "^2.0", "pantheon-systems/drupal-integrations": "^9", "yalesites-org/yalesites_profile": "*" }, @@ -57,6 +58,7 @@ "[project-root]/.gitattributes": false } }, + "installer-types": ["npm-asset"], "installer-paths": { "web/core": [ "type:drupal-core" @@ -87,6 +89,9 @@ ], "web/private/scripts/quicksilver/{$name}/": [ "type:quicksilver-script" + ], + "web/libraries/chosen": [ + "jjj/chosen" ] }, "enable-patching": true, @@ -106,7 +111,8 @@ "composer/installers": true, "cweagans/composer-patches": true, "drupal/core-composer-scaffold": true, - "drupal/console-extend-plugin": true + "drupal/console-extend-plugin": true, + "oomphinc/composer-installers-extender": true } }, "scripts": { diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index a2e583b759..9d1018c94e 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -81,6 +81,7 @@ "drupal/upgrade_status": "^3.18", "drupal/webform": "^6.2@beta", "drupal/wingsuit_companion": "^2.0@RC", + "jjj/chosen": "^2.2", "yalesites-org/atomic": "1.17.0", "yalesites-org/yale_cas": "^1.0" }, From 15fe9a27a0188dfe9c93d65ce6748d58de69998c Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 17 Aug 2023 14:17:48 -0700 Subject: [PATCH 13/88] feat(YALB-1485): WIP Start of footer form fields --- .../ys_core/src/Form/FooterSettingsForm.php | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 4870867718..2ae84eb62a 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -52,11 +52,40 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); $config = $this->config('ys_core.social_links'); + + $form['footer_tabs'] = [ + '#type' => 'vertical_tabs', + ]; + + $form['footer_content'] = [ + '#type' => 'details', + '#title' => $this->t('Footer Content'), + '#open' => TRUE, + '#group' => 'footer_tabs', + ]; + + $form['footer_links'] = [ + '#type' => 'details', + '#title' => $this->t('Footer Links'), + '#group' => 'footer_tabs', + ]; + $form['social_links'] = [ '#type' => 'details', '#title' => $this->t('Social Links'), - '#open' => TRUE, + '#group' => 'footer_tabs', ]; + + $form['footer_content']['footer_logos'] = [ + '#type' => 'media_library', + '#allowed_bundles' => ['image'], + '#title' => $this->t('Footer logos'), + '#required' => FALSE, + '#cardinality' => 4, + //'#default_value' => ($yaleConfig->get('image_fallback')) ? $yaleConfig->get('image_fallback')['teaser'] : NULL, + //'#description' => $this->t('This image will be used for event and post card displays when no teaser image is selected.'), + ]; + foreach ($this->socialLinks::SITES as $id => $name) { $form['social_links'][$id] = [ '#type' => 'url', @@ -64,6 +93,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => $config->get($id), ]; } + return $form; } From 1c9938efebd33a8908310ab175d116787afe3c68 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 17 Aug 2023 16:30:44 -0700 Subject: [PATCH 14/88] feat(YALB-1485): WIP Adding structure to footer settings form --- .../custom/yalesites_profile/composer.json | 1 + .../ys_core/css/footer-settings-form.css | 15 +++++ .../ys_core/src/Form/FooterSettingsForm.php | 59 ++++++++++++++++++- .../custom/ys_core/ys_core.libraries.yml | 4 ++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index 77f08825f4..a98d52b802 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -60,6 +60,7 @@ "drupal/metatag": "^1.19", "drupal/migrate_plus": "^6.0", "drupal/migrate_tools": "^6.0", + "drupal/multivalue_form_element": "^1.0@beta", "drupal/node_revision_delete": "^1.0@RC", "drupal/override_node_options": "^2.6", "drupal/pantheon_advanced_page_cache": "^2.1", diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css new file mode 100644 index 0000000000..4659b01e28 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css @@ -0,0 +1,15 @@ +/* @media screen and (min-width: 640px) { + .ys-footer-links .claro-details__content { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 2rem; + } +} + +.ys-footer-links + .gin-layer-wrapper + table.field-multiple-table + th + .form-item__label { + color: var(--wool) !important; +} */ diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 2ae84eb62a..dcb997306e 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -53,8 +53,10 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); $config = $this->config('ys_core.social_links'); + $form['#attached']['library'][] = 'ys_core/footer_settings_form'; + $form['footer_tabs'] = [ - '#type' => 'vertical_tabs', + '#type' => 'horizontal_tabs', ]; $form['footer_content'] = [ @@ -68,6 +70,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'details', '#title' => $this->t('Footer Links'), '#group' => 'footer_tabs', + '#attributes' => [ + 'class' => [ + 'ys-footer-links', + ], + ], ]; $form['social_links'] = [ @@ -86,6 +93,56 @@ public function buildForm(array $form, FormStateInterface $form_state) { //'#description' => $this->t('This image will be used for event and post card displays when no teaser image is selected.'), ]; + $form['footer_links']['links_col_1_heading'] = [ + '#type' => 'textfield', + '#title' => $this->t('Link Column 1 Heading'), + ]; + + $form['footer_links']['links_col_2_heading'] = [ + '#type' => 'textfield', + '#title' => $this->t('Link Column 2 Heading'), + ]; + + $form['footer_links']['links_col_1'] = [ + '#type' => 'multivalue', + '#title' => $this->t('Links Column 1'), + '#cardinality' => 4, + 'link_url' => [ + '#type' => 'linkit', + '#title' => $this->t('URL'), + '#description' => $this->t('Type the URL or autocomplete for internal paths.'), + '#autocomplete_route_name' => 'linkit.autocomplete', + '#default_value' => $config->get('alert.link_url'), + '#autocomplete_route_parameters' => [ + 'linkit_profile_id' => 'default', + ], + ], + 'link_title' => [ + '#type' => 'textfield', + '#title' => $this->t('Link Title'), + ], + ]; + + $form['footer_links']['links_col_2'] = [ + '#type' => 'multivalue', + '#title' => $this->t('Links Column 2'), + '#cardinality' => 4, + 'link_url' => [ + '#type' => 'linkit', + '#title' => $this->t('URL'), + '#description' => $this->t('Type the URL or autocomplete for internal paths.'), + '#autocomplete_route_name' => 'linkit.autocomplete', + '#default_value' => $config->get('alert.link_url'), + '#autocomplete_route_parameters' => [ + 'linkit_profile_id' => 'default', + ], + ], + 'link_title' => [ + '#type' => 'textfield', + '#title' => $this->t('Link Title'), + ], + ]; + foreach ($this->socialLinks::SITES as $id => $name) { $form['social_links'][$id] = [ '#type' => 'url', diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml index 802ce73c3b..0da15c2266 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml @@ -12,3 +12,7 @@ taxonomy_form: siteimprove: js: https://siteimproveanalytics.com/js/siteanalyze_66356571.js: { type: external, attributes: { async: true } } +footer_settings_form: + css: + theme: + css/footer-settings-form.css: {} From 60f9539be044797022c5c85b4220a50a752bd619 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 17 Aug 2023 18:10:30 -0700 Subject: [PATCH 15/88] feat(YALB-1485): WIP Saving config values and form validation for links --- .../install/ys_core.footer_settings.yml | 8 ++ .../ys_core/css/footer-settings-form.css | 12 +-- .../ys_core/src/Form/FooterSettingsForm.php | 79 ++++++++++++++++--- 3 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml new file mode 100644 index 0000000000..107d75c597 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml @@ -0,0 +1,8 @@ +content: + logos: [] + text: [] +links: + column_1_heading: '' + column_2_heading: '' + column_1_links: [] + column_2_links: [] diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css index 4659b01e28..38d5ea23e2 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css @@ -1,15 +1,7 @@ -/* @media screen and (min-width: 640px) { - .ys-footer-links .claro-details__content { +@media screen and (min-width: 1380px) { + .ys-footer-links .details-wrapper { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; } } - -.ys-footer-links - .gin-layer-wrapper - table.field-multiple-table - th - .form-item__label { - color: var(--wool) !important; -} */ diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index dcb997306e..09678da821 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -6,6 +6,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Routing\TrustedRedirectResponse; use Drupal\ys_core\SocialLinksManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -51,7 +52,8 @@ public function getFormId() { public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); - $config = $this->config('ys_core.social_links'); + $socialConfig = $this->config('ys_core.social_links'); + $footerConfig = $this->config('ys_core.footer_settings'); $form['#attached']['library'][] = 'ys_core/footer_settings_form'; @@ -85,22 +87,30 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['footer_content']['footer_logos'] = [ '#type' => 'media_library', - '#allowed_bundles' => ['image'], '#title' => $this->t('Footer logos'), + '#allowed_bundles' => ['image'], '#required' => FALSE, '#cardinality' => 4, - //'#default_value' => ($yaleConfig->get('image_fallback')) ? $yaleConfig->get('image_fallback')['teaser'] : NULL, - //'#description' => $this->t('This image will be used for event and post card displays when no teaser image is selected.'), + '#default_value' => ($footerConfig->get('content.logos')) ? implode(',', $footerConfig->get('content.logos')) : NULL, + ]; + + $form['footer_content']['footer_text'] = [ + '#type' => 'text_format', + '#title' => $this->t('Text Content'), + '#format' => 'restricted_html', + '#default_value' => (isset($footerConfig->get('content.text')['value'])) ? $footerConfig->get('content.text')['value'] : NULL, ]; $form['footer_links']['links_col_1_heading'] = [ '#type' => 'textfield', '#title' => $this->t('Link Column 1 Heading'), + '#default_value' => ($footerConfig->get('links.links_col_1_heading')) ? $footerConfig->get('links.links_col_1_heading') : NULL, ]; $form['footer_links']['links_col_2_heading'] = [ '#type' => 'textfield', '#title' => $this->t('Link Column 2 Heading'), + '#default_value' => ($footerConfig->get('links.links_col_2_heading')) ? $footerConfig->get('links.links_col_2_heading') : NULL, ]; $form['footer_links']['links_col_1'] = [ @@ -112,7 +122,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('URL'), '#description' => $this->t('Type the URL or autocomplete for internal paths.'), '#autocomplete_route_name' => 'linkit.autocomplete', - '#default_value' => $config->get('alert.link_url'), + //'#default_value' => $config->get('alert.link_url'), '#autocomplete_route_parameters' => [ 'linkit_profile_id' => 'default', ], @@ -132,7 +142,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('URL'), '#description' => $this->t('Type the URL or autocomplete for internal paths.'), '#autocomplete_route_name' => 'linkit.autocomplete', - '#default_value' => $config->get('alert.link_url'), + //'#default_value' => $config->get('alert.link_url'), '#autocomplete_route_parameters' => [ 'linkit_profile_id' => 'default', ], @@ -147,13 +157,21 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['social_links'][$id] = [ '#type' => 'url', '#title' => $this->t('@name URL', ['@name' => $name]), - '#default_value' => $config->get($id), + '#default_value' => $socialConfig->get($id), ]; } return $form; } + /** + * {@inheritdoc} + */ + public function validateForm(array &$form, FormStateInterface $form_state) { + $this->validateFooterLinks($form_state, 'links_col_1'); + $this->validateFooterLinks($form_state, 'links_col_2'); + } + /** * Submit form action. * @@ -163,11 +181,22 @@ public function buildForm(array $form, FormStateInterface $form_state) { * Form state. */ public function submitForm(array &$form, FormStateInterface $form_state) { - $config = $this->config('ys_core.social_links'); + // Social config. + $socialConfig = $this->config('ys_core.social_links'); foreach ($this->socialLinks::SITES as $id => $name) { - $config->set($id, $form_state->getValue($id)); + $socialConfig->set($id, $form_state->getValue($id)); } - $config->save(); + $socialConfig->save(); + + // Footer settings config. + $footerConfig = $this->config('ys_core.footer_settings'); + $footerConfig->set('content.logos', explode(',', $form_state->getValue('footer_logos'))); + $footerConfig->set('content.text', $form_state->getValue('footer_text')); + $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); + $footerConfig->set('links.links_col_2_heading', $form_state->getValue('links_col_2_heading')); + + $footerConfig->save(); + $this->cacheRender->invalidateAll(); return parent::submitForm($form, $form_state); } @@ -178,6 +207,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { protected function getEditableConfigNames() { return [ 'ys_core.social_links', + 'ys_core.footer_settings', ]; } @@ -208,4 +238,33 @@ public function __construct(ConfigFactoryInterface $config_factory, CacheBackend $this->socialLinks = $social_links_manager; } + protected function validateFooterLinks($form_state, $field_id) { + if (($value = $form_state->getValue($field_id))) { + foreach ($value as $index => $link) { + + // if (empty($link['link_url'])) { + // $form_state->setErrorByName( + // $field_id, + // $this->t( + // "Links must contain a URL", + // ['%path' => $form_state->getValue($field_id)] + // ) + // ); + // } + global $base_url; + + if (empty($link['link_title'])) { + $response = new TrustedRedirectResponse($base_url . '/admin/yalesites/footer#edit-footer-links'); + + $form_state->setErrorByName( + $field_id, + $this->t("Links must contain a title"), + ); + $form_state->setResponse($response); + } + + } + } + } + } From ab028f92cdaf0f23a6cf128aca5c8ca72d1870da Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 17 Aug 2023 22:08:18 -0700 Subject: [PATCH 16/88] feat(YALB-1485): Initial form finished, ready for testing --- .../ys_core/src/Form/FooterSettingsForm.php | 53 ++++++++----------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 09678da821..9e1d0a94fa 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -6,7 +6,6 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Routing\TrustedRedirectResponse; use Drupal\ys_core\SocialLinksManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -57,21 +56,15 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['#attached']['library'][] = 'ys_core/footer_settings_form'; - $form['footer_tabs'] = [ - '#type' => 'horizontal_tabs', - ]; - $form['footer_content'] = [ '#type' => 'details', '#title' => $this->t('Footer Content'), '#open' => TRUE, - '#group' => 'footer_tabs', ]; $form['footer_links'] = [ '#type' => 'details', '#title' => $this->t('Footer Links'), - '#group' => 'footer_tabs', '#attributes' => [ 'class' => [ 'ys-footer-links', @@ -82,7 +75,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['social_links'] = [ '#type' => 'details', '#title' => $this->t('Social Links'), - '#group' => 'footer_tabs', ]; $form['footer_content']['footer_logos'] = [ @@ -113,16 +105,17 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => ($footerConfig->get('links.links_col_2_heading')) ? $footerConfig->get('links.links_col_2_heading') : NULL, ]; - $form['footer_links']['links_col_1'] = [ + $form['footer_links']['column_1_links'] = [ '#type' => 'multivalue', '#title' => $this->t('Links Column 1'), '#cardinality' => 4, + '#default_value' => ($footerConfig->get('links.column_1_links')) ? $footerConfig->get('links.column_1_links') : NULL, + 'link_url' => [ '#type' => 'linkit', '#title' => $this->t('URL'), '#description' => $this->t('Type the URL or autocomplete for internal paths.'), '#autocomplete_route_name' => 'linkit.autocomplete', - //'#default_value' => $config->get('alert.link_url'), '#autocomplete_route_parameters' => [ 'linkit_profile_id' => 'default', ], @@ -130,19 +123,20 @@ public function buildForm(array $form, FormStateInterface $form_state) { 'link_title' => [ '#type' => 'textfield', '#title' => $this->t('Link Title'), + '#default_value' => (isset($footerConfig->get('links.links_col_1')['link_title'])) ? $footerConfig->get('links.links_col_1')['link_title'] : NULL, ], ]; - $form['footer_links']['links_col_2'] = [ + $form['footer_links']['column_2_links'] = [ '#type' => 'multivalue', '#title' => $this->t('Links Column 2'), '#cardinality' => 4, + '#default_value' => ($footerConfig->get('links.column_2_links')) ? $footerConfig->get('links.column_2_links') : NULL, 'link_url' => [ '#type' => 'linkit', '#title' => $this->t('URL'), '#description' => $this->t('Type the URL or autocomplete for internal paths.'), '#autocomplete_route_name' => 'linkit.autocomplete', - //'#default_value' => $config->get('alert.link_url'), '#autocomplete_route_parameters' => [ 'linkit_profile_id' => 'default', ], @@ -168,8 +162,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { - $this->validateFooterLinks($form_state, 'links_col_1'); - $this->validateFooterLinks($form_state, 'links_col_2'); + $this->validateFooterLinks($form_state, 'column_1_links'); + $this->validateFooterLinks($form_state, 'column_2_links'); } /** @@ -194,6 +188,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); $footerConfig->set('links.links_col_2_heading', $form_state->getValue('links_col_2_heading')); + $footerConfig->set('links.column_1_links', $form_state->getValue('column_1_links')); + $footerConfig->set('links.column_2_links', $form_state->getValue('column_2_links')); $footerConfig->save(); @@ -238,29 +234,22 @@ public function __construct(ConfigFactoryInterface $config_factory, CacheBackend $this->socialLinks = $social_links_manager; } + /** + * Check that footer links have both a URL and a link title. + * + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state of the parent form. + * @param string $field_id + * The id of a field on the config form. + */ protected function validateFooterLinks($form_state, $field_id) { if (($value = $form_state->getValue($field_id))) { - foreach ($value as $index => $link) { - - // if (empty($link['link_url'])) { - // $form_state->setErrorByName( - // $field_id, - // $this->t( - // "Links must contain a URL", - // ['%path' => $form_state->getValue($field_id)] - // ) - // ); - // } - global $base_url; - - if (empty($link['link_title'])) { - $response = new TrustedRedirectResponse($base_url . '/admin/yalesites/footer#edit-footer-links'); - + foreach ($value as $link) { + if (empty($link['link_url']) || empty($link['link_title'])) { $form_state->setErrorByName( $field_id, - $this->t("Links must contain a title"), + $this->t("Any link specified must have both a URL and a link title."), ); - $form_state->setResponse($response); } } From 19b6cbebc4da241d1bac0709997f098e44ae35d5 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 18 Aug 2023 12:17:42 -0700 Subject: [PATCH 17/88] feat(YALB-1485): WIP start on footer block --- .../ys_core/css/footer-settings-form.css | 2 +- .../ys_core/src/Form/FooterSettingsForm.php | 12 +++- .../src/Plugin/Block/YaleSitesFooterBlock.php | 68 +++++++++++++++++++ .../templates/ys-footer-block.html.twig | 3 + .../modules/custom/ys_core/ys_core.module | 5 ++ 5 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css index 38d5ea23e2..0f8f2e8bfe 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css @@ -1,5 +1,5 @@ @media screen and (min-width: 1380px) { - .ys-footer-links .details-wrapper { + .ys-footer-links .details-wrapper, .ys-footer-links .claro-details__content { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 9e1d0a94fa..b8b1863ee2 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -56,15 +56,21 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['#attached']['library'][] = 'ys_core/footer_settings_form'; + // $form['footer_tabs'] = [ + // '#type' => 'vertical_tabs', + // ]; + $form['footer_content'] = [ '#type' => 'details', '#title' => $this->t('Footer Content'), '#open' => TRUE, + '#group' => 'footer_tabs', ]; $form['footer_links'] = [ '#type' => 'details', '#title' => $this->t('Footer Links'), + '#group' => 'footer_tabs', '#attributes' => [ 'class' => [ 'ys-footer-links', @@ -75,6 +81,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['social_links'] = [ '#type' => 'details', '#title' => $this->t('Social Links'), + '#group' => 'footer_tabs', ]; $form['footer_content']['footer_logos'] = [ @@ -109,7 +116,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'multivalue', '#title' => $this->t('Links Column 1'), '#cardinality' => 4, - '#default_value' => ($footerConfig->get('links.column_1_links')) ? $footerConfig->get('links.column_1_links') : NULL, + '#default_value' => ($footerConfig->get('links.column_1_links')) ? $footerConfig->get('links.column_1_links') : [], 'link_url' => [ '#type' => 'linkit', @@ -123,7 +130,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { 'link_title' => [ '#type' => 'textfield', '#title' => $this->t('Link Title'), - '#default_value' => (isset($footerConfig->get('links.links_col_1')['link_title'])) ? $footerConfig->get('links.links_col_1')['link_title'] : NULL, ], ]; @@ -131,7 +137,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'multivalue', '#title' => $this->t('Links Column 2'), '#cardinality' => 4, - '#default_value' => ($footerConfig->get('links.column_2_links')) ? $footerConfig->get('links.column_2_links') : NULL, + '#default_value' => ($footerConfig->get('links.column_2_links')) ? $footerConfig->get('links.column_2_links') : [], 'link_url' => [ '#type' => 'linkit', '#title' => $this->t('URL'), diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php new file mode 100644 index 0000000000..07f229fc81 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -0,0 +1,68 @@ +socialLinks = $social_links_manager; + $this->footerSettings = $config_factory->get('ys_core.footer_settings'); + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('ys_core.social_links_manager'), + $container->get('config.factory'), + ); + } + + /** + * {@inheritdoc} + */ + public function build() { + return [ + '#theme' => 'ys_footer_block', + '#footer_links_heading_1' => $this->footerSettings->get('links.links_col_1_heading'), + ]; + } + +} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig new file mode 100644 index 0000000000..7a077f0c62 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -0,0 +1,3 @@ +In new footer block + +{{ footer_links_heading_1 }} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index c371fd59b1..ef2dda25fe 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -53,6 +53,11 @@ function ys_core_theme($existing, $type, $theme, $path): array { 'breadcrumbs_placeholder' => [], ], ], + 'ys_footer_block' => [ + 'variables' => [ + 'footer_links_heading_1' => NULL, + ] + ], ]; } From 3440ef11164e0ad3ad7e7483d0873956255c4d28 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 18 Aug 2023 13:42:06 -0700 Subject: [PATCH 18/88] feat(YALB-1485): WIP Adding more items to footer block --- .../custom/ys_core/src/Form/FooterSettingsForm.php | 10 ++++++---- .../ys_core/src/Plugin/Block/YaleSitesFooterBlock.php | 1 + .../custom/ys_core/templates/ys-footer-block.html.twig | 9 +++++++-- .../modules/custom/ys_core/ys_core.module | 1 + 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index b8b1863ee2..c6a0054cb9 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -56,9 +56,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['#attached']['library'][] = 'ys_core/footer_settings_form'; - // $form['footer_tabs'] = [ - // '#type' => 'vertical_tabs', - // ]; + $form['footer_tabs'] = [ + '#type' => 'vertical_tabs', + ]; $form['footer_content'] = [ '#type' => 'details', @@ -190,7 +190,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Footer settings config. $footerConfig = $this->config('ys_core.footer_settings'); - $footerConfig->set('content.logos', explode(',', $form_state->getValue('footer_logos'))); + if ($form_state->getValue('footer_logos')) { + $footerConfig->set('content.logos', explode(',', $form_state->getValue('footer_logos'))); + } $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); $footerConfig->set('links.links_col_2_heading', $form_state->getValue('links_col_2_heading')); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index 07f229fc81..5f5b49a47e 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -62,6 +62,7 @@ public function build() { return [ '#theme' => 'ys_footer_block', '#footer_links_heading_1' => $this->footerSettings->get('links.links_col_1_heading'), + '#footer_links_heading_2' => $this->footerSettings->get('links.links_col_2_heading'), ]; } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 7a077f0c62..15fa52174c 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,3 +1,8 @@ -In new footer block +

Mega Footer Block

+ +
    +
  • Col 1 heading: {{ footer_links_heading_1 }}
  • +
  • Col 2 heading: {{ footer_links_heading_2 }}
  • +
+ -{{ footer_links_heading_1 }} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index ef2dda25fe..01f4dbbfcd 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -56,6 +56,7 @@ function ys_core_theme($existing, $type, $theme, $path): array { 'ys_footer_block' => [ 'variables' => [ 'footer_links_heading_1' => NULL, + 'footer_links_heading_2' => NULL, ] ], ]; From 5830bae3ae7144f540ab57e36f7d963af7505779 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Mon, 21 Aug 2023 14:50:23 -0700 Subject: [PATCH 19/88] feat(YALB-1485): Enable multivalue form element --- .../custom/yalesites_profile/config/sync/core.extension.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml b/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml index 54805aaf74..34aeb2e21e 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml @@ -82,6 +82,7 @@ module: migrate: 0 migrate_plus: 0 migrate_tools: 0 + multivalue_form_element: 0 mysql: 0 node: 0 node_revision_delete: 0 From a06b71591a4357b44a0bc3ef51eaac8726020069 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Mon, 21 Aug 2023 16:37:26 -0700 Subject: [PATCH 20/88] feat(YALB-1485): Add school logo field --- .../config/install/ys_core.footer_settings.yml | 1 + .../ys_core/src/Form/FooterSettingsForm.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml index 107d75c597..d422a9fb5c 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml @@ -1,5 +1,6 @@ content: logos: [] + school_logo: '' text: [] links: column_1_heading: '' diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index c6a0054cb9..3af6a628da 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -91,6 +91,17 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#required' => FALSE, '#cardinality' => 4, '#default_value' => ($footerConfig->get('content.logos')) ? implode(',', $footerConfig->get('content.logos')) : NULL, + '#description' => $this->t('A grid of up to 4 roughly-square logos on the left side of the footer.'), + ]; + + $form['footer_content']['school_logo'] = [ + '#type' => 'media_library', + '#title' => $this->t('School logo'), + '#allowed_bundles' => ['image'], + '#required' => FALSE, + '#cardinality' => 4, + '#default_value' => ($footerConfig->get('content.school_logo')) ? $footerConfig->get('content.school_logo') : NULL, + '#description' => $this->t('A horizontal logotype that is placed below the 4 logos on the left side of the footer.'), ]; $form['footer_content']['footer_text'] = [ @@ -102,13 +113,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['footer_links']['links_col_1_heading'] = [ '#type' => 'textfield', - '#title' => $this->t('Link Column 1 Heading'), + '#title' => $this->t('Links Column 1 Heading'), '#default_value' => ($footerConfig->get('links.links_col_1_heading')) ? $footerConfig->get('links.links_col_1_heading') : NULL, ]; $form['footer_links']['links_col_2_heading'] = [ '#type' => 'textfield', - '#title' => $this->t('Link Column 2 Heading'), + '#title' => $this->t('Links Column 2 Heading'), '#default_value' => ($footerConfig->get('links.links_col_2_heading')) ? $footerConfig->get('links.links_col_2_heading') : NULL, ]; @@ -193,6 +204,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { if ($form_state->getValue('footer_logos')) { $footerConfig->set('content.logos', explode(',', $form_state->getValue('footer_logos'))); } + $footerConfig->set('content.school_logo', $form_state->getValue('school_logo')); $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); $footerConfig->set('links.links_col_2_heading', $form_state->getValue('links_col_2_heading')); From 9973cec45ccb2ab365a47e740a1835e16a146dec Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 22 Aug 2023 12:39:52 -0700 Subject: [PATCH 21/88] feat(YALB-1485): WIP Add additional fields to template such as logos --- .../custom/yalesites_profile/composer.json | 3 ++ .../ys_core/src/Form/FooterSettingsForm.php | 5 +++ .../src/Plugin/Block/YaleSitesFooterBlock.php | 33 ++++++++++++++++++- .../templates/ys-footer-block.html.twig | 4 +-- .../modules/custom/ys_core/ys_core.module | 2 ++ 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index 1acbd27941..f98b343c6d 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -127,6 +127,9 @@ }, "drupal/gin": { "fix description toggle for CKEditor fields https://www.drupal.org/project/gin/issues/3316265": "https://git.drupalcode.org/project/gin/-/merge_requests/227.patch" + }, + "drupal/media_library_form_element": { + "Order Media items https://www.drupal.org/project/media_library_form_element/issues/3168027":"https://www.drupal.org/files/issues/2021-12-27/order_media_items-3168027-4.patch" } } } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 3af6a628da..8443341819 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -201,9 +201,14 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Footer settings config. $footerConfig = $this->config('ys_core.footer_settings'); + if ($form_state->getValue('footer_logos')) { $footerConfig->set('content.logos', explode(',', $form_state->getValue('footer_logos'))); } + else { + $footerConfig->set('content.logos', []); + } + $footerConfig->set('content.school_logo', $form_state->getValue('school_logo')); $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index 5f5b49a47e..e1aff70155 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -4,6 +4,7 @@ use Drupal\Core\Block\BlockBase; use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\Entity\EntityTypeManager; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\ys_core\SocialLinksManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -33,13 +34,28 @@ class YaleSitesFooterBlock extends BlockBase implements ContainerFactoryPluginIn */ protected $footerSettings; + /** + * Entity type manager. + * + * @var Drupal\Core\Entity\EntityTypeManager + */ + protected $entityTypeManager; + /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, SocialLinksManager $social_links_manager, ConfigFactoryInterface $config_factory) { + public function __construct( + array $configuration, + $plugin_id, + $plugin_definition, + SocialLinksManager $social_links_manager, + ConfigFactoryInterface $config_factory, + EntityTypeManager $entity_type_manager, + ) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->socialLinks = $social_links_manager; $this->footerSettings = $config_factory->get('ys_core.footer_settings'); + $this->entityTypeManager = $entity_type_manager; } /** @@ -52,6 +68,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $container->get('ys_core.social_links_manager'), $container->get('config.factory'), + $container->get('entity_type.manager'), ); } @@ -59,8 +76,22 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function build() { + + $footerLogoIds = $this->footerSettings->get('content.logos'); + + foreach ($footerLogoIds as $logoId) { + $media = $this->entityTypeManager->getStorage('media')->load($logoId); + $footerLogos[] = $this->entityTypeManager->getViewBuilder('media')->view($media, 'profile_directory_card_1_1_'); + } + return [ '#theme' => 'ys_footer_block', + '#footer_logos' => $footerLogos, + '#footer_text' => [ + '#type' => 'processed_text', + '#text' => $this->footerSettings->get('content.text')['value'], + '#format' => 'restricted_html', + ], '#footer_links_heading_1' => $this->footerSettings->get('links.links_col_1_heading'), '#footer_links_heading_2' => $this->footerSettings->get('links.links_col_2_heading'), ]; diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 15fa52174c..309b3a2108 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -3,6 +3,6 @@
  • Col 1 heading: {{ footer_links_heading_1 }}
  • Col 2 heading: {{ footer_links_heading_2 }}
  • +
  • Footer text: {{ footer_text }}
  • +
  • Footer logos: {{ footer_logos }}
- - diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index e709e99980..6e176520c2 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -55,6 +55,8 @@ function ys_core_theme($existing, $type, $theme, $path): array { ], 'ys_footer_block' => [ 'variables' => [ + 'footer_logos' => [], + 'footer_text' => NULL, 'footer_links_heading_1' => NULL, 'footer_links_heading_2' => NULL, ] From 1a83e77f61a919357b765309bfa3cb46a73b65cd Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 22 Aug 2023 14:38:04 -0700 Subject: [PATCH 22/88] feat(YALB-1485): Finish variables in twig --- .../custom/yalesites_profile/composer.json | 2 +- .../install/ys_core.footer_settings.yml | 10 +++---- .../ys_core/src/Form/FooterSettingsForm.php | 26 +++++++------------ .../src/Plugin/Block/YaleSitesFooterBlock.php | 22 ++++++++++++---- .../templates/ys-footer-block.html.twig | 21 +++++++++++++-- .../modules/custom/ys_core/ys_core.module | 7 +++-- 6 files changed, 57 insertions(+), 31 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index f98b343c6d..32ef984c2f 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -129,7 +129,7 @@ "fix description toggle for CKEditor fields https://www.drupal.org/project/gin/issues/3316265": "https://git.drupalcode.org/project/gin/-/merge_requests/227.patch" }, "drupal/media_library_form_element": { - "Order Media items https://www.drupal.org/project/media_library_form_element/issues/3168027":"https://www.drupal.org/files/issues/2021-12-27/order_media_items-3168027-4.patch" + "Order Media items https://www.drupal.org/project/media_library_form_element/issues/3168027":"https://www.drupal.org/files/issues/2022-01-22/order_media_items-3168027-8.patch" } } } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml index d422a9fb5c..db05a5cf37 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml @@ -1,9 +1,9 @@ content: - logos: [] + logos: '' school_logo: '' text: [] links: - column_1_heading: '' - column_2_heading: '' - column_1_links: [] - column_2_links: [] + links_col_1_heading: '' + links_col_2_heading: '' + links_col_1: [] + links_col_2: [] diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 8443341819..a96987152c 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -90,7 +90,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#allowed_bundles' => ['image'], '#required' => FALSE, '#cardinality' => 4, - '#default_value' => ($footerConfig->get('content.logos')) ? implode(',', $footerConfig->get('content.logos')) : NULL, + '#default_value' => ($footerConfig->get('content.logos')) ? $footerConfig->get('content.logos') : NULL, '#description' => $this->t('A grid of up to 4 roughly-square logos on the left side of the footer.'), ]; @@ -123,11 +123,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => ($footerConfig->get('links.links_col_2_heading')) ? $footerConfig->get('links.links_col_2_heading') : NULL, ]; - $form['footer_links']['column_1_links'] = [ + $form['footer_links']['links_col_1'] = [ '#type' => 'multivalue', '#title' => $this->t('Links Column 1'), '#cardinality' => 4, - '#default_value' => ($footerConfig->get('links.column_1_links')) ? $footerConfig->get('links.column_1_links') : [], + '#default_value' => ($footerConfig->get('links.links_col_1')) ? $footerConfig->get('links.links_col_1') : [], 'link_url' => [ '#type' => 'linkit', @@ -144,11 +144,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { ], ]; - $form['footer_links']['column_2_links'] = [ + $form['footer_links']['links_col_2'] = [ '#type' => 'multivalue', '#title' => $this->t('Links Column 2'), '#cardinality' => 4, - '#default_value' => ($footerConfig->get('links.column_2_links')) ? $footerConfig->get('links.column_2_links') : [], + '#default_value' => ($footerConfig->get('links.links_col_2')) ? $footerConfig->get('links.links_col_2') : [], 'link_url' => [ '#type' => 'linkit', '#title' => $this->t('URL'), @@ -179,8 +179,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { - $this->validateFooterLinks($form_state, 'column_1_links'); - $this->validateFooterLinks($form_state, 'column_2_links'); + $this->validateFooterLinks($form_state, 'links_col_1'); + $this->validateFooterLinks($form_state, 'links_col_2'); } /** @@ -202,19 +202,13 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Footer settings config. $footerConfig = $this->config('ys_core.footer_settings'); - if ($form_state->getValue('footer_logos')) { - $footerConfig->set('content.logos', explode(',', $form_state->getValue('footer_logos'))); - } - else { - $footerConfig->set('content.logos', []); - } - + $footerConfig->set('content.logos', $form_state->getValue('footer_logos')); $footerConfig->set('content.school_logo', $form_state->getValue('school_logo')); $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); $footerConfig->set('links.links_col_2_heading', $form_state->getValue('links_col_2_heading')); - $footerConfig->set('links.column_1_links', $form_state->getValue('column_1_links')); - $footerConfig->set('links.column_2_links', $form_state->getValue('column_2_links')); + $footerConfig->set('links.links_col_1', $form_state->getValue('links_col_1')); + $footerConfig->set('links.links_col_2', $form_state->getValue('links_col_2')); $footerConfig->save(); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index e1aff70155..753d80ed3d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -77,23 +77,35 @@ public static function create(ContainerInterface $container, array $configuratio */ public function build() { - $footerLogoIds = $this->footerSettings->get('content.logos'); + $footerLogoIds = explode(",", $this->footerSettings->get('content.logos')); + $footerLogos = []; foreach ($footerLogoIds as $logoId) { - $media = $this->entityTypeManager->getStorage('media')->load($logoId); - $footerLogos[] = $this->entityTypeManager->getViewBuilder('media')->view($media, 'profile_directory_card_1_1_'); + $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoId); + $footerLogos[] = $this->entityTypeManager->getViewBuilder('media')->view($footerLogoMedia, 'profile_directory_card_1_1_'); + } + + $schoolLogoId = $this->footerSettings->get('content.school_logo'); + $schoolLogo = []; + + if ($schoolLogoId) { + $schoolLogoMedia = $this->entityTypeManager->getStorage('media')->load($schoolLogoId); + $schoolLogo = $this->entityTypeManager->getViewBuilder('media')->view($schoolLogoMedia, 'profile_directory_card_1_1_'); } return [ '#theme' => 'ys_footer_block', '#footer_logos' => $footerLogos, + '#school_logo' => $schoolLogo, '#footer_text' => [ '#type' => 'processed_text', '#text' => $this->footerSettings->get('content.text')['value'], '#format' => 'restricted_html', ], - '#footer_links_heading_1' => $this->footerSettings->get('links.links_col_1_heading'), - '#footer_links_heading_2' => $this->footerSettings->get('links.links_col_2_heading'), + '#footer_links_col_1_heading' => $this->footerSettings->get('links.links_col_1_heading'), + '#footer_links_col_2_heading' => $this->footerSettings->get('links.links_col_2_heading'), + '#footer_links_col_1' => $this->footerSettings->get('links.links_col_1'), + '#footer_links_col_2' => $this->footerSettings->get('links.links_col_2'), ]; } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 309b3a2108..e30fabdadd 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,8 +1,25 @@

Mega Footer Block

    -
  • Col 1 heading: {{ footer_links_heading_1 }}
  • -
  • Col 2 heading: {{ footer_links_heading_2 }}
  • +
  • Col 1 heading: {{ footer_links_col_1_heading }}
  • +
  • Col 2 heading: {{ footer_links_col_2_heading }}
  • Footer text: {{ footer_text }}
  • Footer logos: {{ footer_logos }}
  • +
  • School logo: {{ school_logo }}
  • +
+ +Footer links Col 1 + + +Footer links Col 2 + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index 6e176520c2..af794b7737 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -56,9 +56,12 @@ function ys_core_theme($existing, $type, $theme, $path): array { 'ys_footer_block' => [ 'variables' => [ 'footer_logos' => [], + 'school_logo' => NULL, 'footer_text' => NULL, - 'footer_links_heading_1' => NULL, - 'footer_links_heading_2' => NULL, + 'footer_links_col_1_heading' => NULL, + 'footer_links_col_2_heading' => NULL, + 'footer_links_col_1' => [], + 'footer_links_col_2' => [], ] ], ]; From 08747d225bd507a88b0951a4e4037c3d70afa6a7 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 22 Aug 2023 15:57:27 -0700 Subject: [PATCH 23/88] feat(YALB-1488): WIP wiring --- .../install/ys_core.footer_settings.yml | 2 +- .../ys_core/src/Form/FooterSettingsForm.php | 42 ++++++++++++++----- .../src/Plugin/Block/YaleSitesFooterBlock.php | 9 ++-- .../templates/ys-footer-block.html.twig | 30 ++++++++++++- 4 files changed, 65 insertions(+), 18 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml index db05a5cf37..3f5fb796b1 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml @@ -1,5 +1,5 @@ content: - logos: '' + logos: [] school_logo: '' text: [] links: diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index a96987152c..83cf1f5d86 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -60,10 +60,16 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'vertical_tabs', ]; + $form['footer_logos'] = [ + '#type' => 'details', + '#title' => $this->t('Footer Logos'), + '#open' => TRUE, + '#group' => 'footer_tabs', + ]; + $form['footer_content'] = [ '#type' => 'details', '#title' => $this->t('Footer Content'), - '#open' => TRUE, '#group' => 'footer_tabs', ]; @@ -84,17 +90,33 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#group' => 'footer_tabs', ]; - $form['footer_content']['footer_logos'] = [ - '#type' => 'media_library', - '#title' => $this->t('Footer logos'), - '#allowed_bundles' => ['image'], - '#required' => FALSE, + $form['footer_logos']['logos'] = [ + '#type' => 'multivalue', + '#title' => $this->t('Footer Logos'), '#cardinality' => 4, - '#default_value' => ($footerConfig->get('content.logos')) ? $footerConfig->get('content.logos') : NULL, - '#description' => $this->t('A grid of up to 4 roughly-square logos on the left side of the footer.'), + '#default_value' => ($footerConfig->get('content.logos')) ? $footerConfig->get('content.logos') : [], + + 'logo' => [ + '#type' => 'media_library', + '#title' => $this->t('Logo'), + '#allowed_bundles' => ['image'], + '#required' => FALSE, + '#cardinality' => 4, + ], + + 'logo_url' => [ + '#type' => 'linkit', + '#title' => $this->t('URL'), + '#description' => $this->t('Type the URL or autocomplete for internal paths.'), + '#autocomplete_route_name' => 'linkit.autocomplete', + '#autocomplete_route_parameters' => [ + 'linkit_profile_id' => 'default', + ], + ], + ]; - $form['footer_content']['school_logo'] = [ + $form['footer_logos']['school_logo'] = [ '#type' => 'media_library', '#title' => $this->t('School logo'), '#allowed_bundles' => ['image'], @@ -202,7 +224,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Footer settings config. $footerConfig = $this->config('ys_core.footer_settings'); - $footerConfig->set('content.logos', $form_state->getValue('footer_logos')); + $footerConfig->set('content.logos', $form_state->getValue('logos')); $footerConfig->set('content.school_logo', $form_state->getValue('school_logo')); $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index 753d80ed3d..05ff7709ee 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -76,13 +76,12 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function build() { - - $footerLogoIds = explode(",", $this->footerSettings->get('content.logos')); $footerLogos = []; - foreach ($footerLogoIds as $logoId) { - $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoId); - $footerLogos[] = $this->entityTypeManager->getViewBuilder('media')->view($footerLogoMedia, 'profile_directory_card_1_1_'); + foreach ($this->footerSettings->get('content.logos') as $key => $logoData) { + $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoData['logo']); + $footerLogos[$key]['logo'] = $this->entityTypeManager->getViewBuilder('media')->view($footerLogoMedia, 'profile_directory_card_1_1_'); + $footerLogos[$key]['url'] = $logoData['logo_url']; } $schoolLogoId = $this->footerSettings->get('content.school_logo'); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index e30fabdadd..85f4828852 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,13 +1,37 @@ -

Mega Footer Block

+ +{% embed "@organisms/site-footer/yds-site-footer.twig" with { + site_footer__border_thickness: '8', + site_footer__theme: getThemeSetting('footer_theme'), + site_footer__variation: 'atrus', +} %} +{% endembed %} + + +{#

Mega Footer Block

  • Col 1 heading: {{ footer_links_col_1_heading }}
  • Col 2 heading: {{ footer_links_col_2_heading }}
  • Footer text: {{ footer_text }}
  • -
  • Footer logos: {{ footer_logos }}
  • School logo: {{ school_logo }}
+Footer logos: + + + Footer links Col 1
    {% for link in footer_links_col_1 %} @@ -23,3 +47,5 @@ Footer links Col 2 {% endfor %}
+ +{{ drupal_block('social_links_block') }} #} From 7ef6fa1c732260b2028c5cd126e2ea745a85d76a Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 22 Aug 2023 16:43:55 -0700 Subject: [PATCH 24/88] feat(YALB-1488): Wiring logos and text --- .../templates/ys-footer-block.html.twig | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 85f4828852..55f95480be 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -2,8 +2,57 @@ {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), - site_footer__variation: 'atrus', + site_footer__variation: 'mega', } %} + + {% block site_footer__logo %} + {% if footer_logos.0.url %} + + {% endif %} + {{ footer_logos.0.logo }} + {% if footer_logos.0.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__logo_2 %} + {% if footer_logos.1.url %} + + {% endif %} + {{ footer_logos.1.logo }} + {% if footer_logos.1.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__logo_3 %} + {% if footer_logos.2.url %} + + {% endif %} + {{ footer_logos.2.logo }} + {% if footer_logos.2.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__logo_4 %} + {% if footer_logos.3.url %} + + {% endif %} + {{ footer_logos.3.logo }} + {% if footer_logos.3.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__yale_logo %} + {{ school_logo }} + {% endblock %} + + {% block site_footer__content %} + {{ footer_text }} + {% endblock %} + {% endembed %} From 1fdc4a1c32d3bfbb6aeb3dc6e5291a5a246b9b17 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Wed, 23 Aug 2023 14:19:25 -0700 Subject: [PATCH 25/88] feat*YALB-1488): WIP Wiring --- .../ys_core/src/Form/FooterSettingsForm.php | 1 - .../ys_core/templates/ys-footer-block.html.twig | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 83cf1f5d86..5c3b6a98e9 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -101,7 +101,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Logo'), '#allowed_bundles' => ['image'], '#required' => FALSE, - '#cardinality' => 4, ], 'logo_url' => [ diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 55f95480be..b077db835f 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,10 +1,23 @@ - {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), site_footer__variation: 'mega', } %} +{# {% block site_footer_logos %} + + {% for logo in footer_logos %} + {% if logo.url %} + + {% endif %} + {{ logo.logo }} + {% if logo.url %} + + {% endif %} + {% endfor %} + +{% endblock %} #} + {% block site_footer__logo %} {% if footer_logos.0.url %} From a6fe55a1bdbac2f1fba1b42a934ce710296661ed Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 23 Aug 2023 17:11:27 -0500 Subject: [PATCH 26/88] fix(yalb-mega-footer): initial wiring --- .../templates/ys-footer-block.html.twig | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 55f95480be..7f32da369d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,3 +1,28 @@ +{# Set variable for all the links so we can reference them in a block below #} +{% set link_group__base_class = 'link-group' %} + +{% set footer_link_columns %} + {% if footer_links_col_1 %} +
    + {% for link in footer_links_col_1 %} + {% include "@molecules/link-group/_yds-link-group--links.twig" with { + link_group__link__url: link.link_url, + link_group__link__content: link.link_title, + }%} + {% endfor %} +
+ {% endif %} + {% if footer_links_col_2 %} +
    + {% for link in footer_links_col_2 %} + {% include "@molecules/link-group/_yds-link-group--links.twig" with { + link_group__link__url: link.link_url, + link_group__link__content: link.link_title, + }%} + {% endfor %} +
+ {% endif %} +{% endset %} {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', @@ -52,7 +77,17 @@ {% block site_footer__content %} {{ footer_text }} {% endblock %} - + + {% block site_footer__two_columns %} + {% embed "@molecules/link-group/yds-link-group.twig" with { + link_group__heading_one: footer_links_col_1_heading, + link_group__heading_two: footer_links_col_2_heading, + } %} + {% block link_group__links %} + {{footer_link_columns}} + {% endblock %} + {% endembed %} + {% endblock %} {% endembed %} From 45cbc910039e1817a2fff9aa95cd98289c62715e Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 10:00:05 -0500 Subject: [PATCH 27/88] fix(yalb-mega-footer): update responsive image style, add image sizes, update templates --- .../config/sync/image.style.max_width_180.yml | 15 +++++++++ .../config/sync/image.style.max_width_212.yml | 15 +++++++++ ...nsive_image.styles.image_content_width.yml | 6 +++- .../responsive_image.styles.image_logos.yml | 33 +++++++++++++++++++ .../src/Plugin/Block/YaleSitesFooterBlock.php | 4 +-- 5 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_180.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_212.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml diff --git a/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_180.yml b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_180.yml new file mode 100644 index 0000000000..8c6020167c --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_180.yml @@ -0,0 +1,15 @@ +uuid: 0635eefd-60e3-47ed-8484-280b09582b68 +langcode: en +status: true +dependencies: { } +name: max_width_180 +label: 'Max-width (180)' +effects: + ce5469b3-d1ee-459b-bf3f-329d38fcac43: + uuid: ce5469b3-d1ee-459b-bf3f-329d38fcac43 + id: image_scale + weight: 1 + data: + width: 180 + height: null + upscale: false diff --git a/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_212.yml b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_212.yml new file mode 100644 index 0000000000..8582a2c23a --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_212.yml @@ -0,0 +1,15 @@ +uuid: cc474f99-212c-426f-a9de-422e27b95aba +langcode: en +status: true +dependencies: { } +name: max_width_212 +label: 'Max-width (212)' +effects: + a30e1716-3d94-4a36-af44-37e9dc68f061: + uuid: a30e1716-3d94-4a36-af44-37e9dc68f061 + id: image_scale + weight: 1 + data: + width: 212 + height: null + upscale: false diff --git a/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_content_width.yml b/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_content_width.yml index 6bf75af1ce..14f67239c8 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_content_width.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_content_width.yml @@ -13,7 +13,9 @@ dependencies: - image.style.max_width_2240 - image.style.max_width_2400 - image.style.max_width_320 + - image.style.max_width_444 - image.style.max_width_480 + - image.style.max_width_540 - image.style.max_width_640 - image.style.max_width_800 - image.style.max_width_896 @@ -26,7 +28,6 @@ image_style_mappings: image_mapping: sizes: '(min-width: 896px) 896px, 100vw' sizes_image_styles: - - max_width_896 - max_width_1120 - max_width_1280 - max_width_1440 @@ -37,9 +38,12 @@ image_style_mappings: - max_width_2240 - max_width_2400 - max_width_320 + - max_width_444 - max_width_480 + - max_width_540 - max_width_640 - max_width_800 + - max_width_896 - max_width_960 breakpoint_id: responsive_image.viewport_sizing multiplier: 1x diff --git a/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml b/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml new file mode 100644 index 0000000000..a5a2da8e09 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml @@ -0,0 +1,33 @@ +uuid: 327ae514-8556-41e7-9fb1-2a0d2218b2fd +langcode: en +status: true +dependencies: + config: + - image.style.max_width_180 + - image.style.max_width_212 + - image.style.max_width_320 + - image.style.max_width_444 + - image.style.max_width_480 + - image.style.max_width_540 + - image.style.max_width_640 + - image.style.max_width_800 +id: image_logos +label: 'Image - Logos' +image_style_mappings: + - + image_mapping_type: sizes + image_mapping: + sizes: '(min-width: 1344px) 212px, (min-width: 992px) 180px, (min-width: 576px) 25vw, 50vw' + sizes_image_styles: + - max_width_180 + - max_width_212 + - max_width_320 + - max_width_444 + - max_width_480 + - max_width_540 + - max_width_640 + - max_width_800 + breakpoint_id: responsive_image.viewport_sizing + multiplier: 1x +breakpoint_group: responsive_image +fallback_image_style: max_width_320 diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index 05ff7709ee..fcf35bbe47 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -80,7 +80,7 @@ public function build() { foreach ($this->footerSettings->get('content.logos') as $key => $logoData) { $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoData['logo']); - $footerLogos[$key]['logo'] = $this->entityTypeManager->getViewBuilder('media')->view($footerLogoMedia, 'profile_directory_card_1_1_'); + $footerLogos[$key]['logo'] = $this->entityTypeManager->getViewBuilder('media')->view($footerLogoMedia, 'image_logos'); $footerLogos[$key]['url'] = $logoData['logo_url']; } @@ -89,7 +89,7 @@ public function build() { if ($schoolLogoId) { $schoolLogoMedia = $this->entityTypeManager->getStorage('media')->load($schoolLogoId); - $schoolLogo = $this->entityTypeManager->getViewBuilder('media')->view($schoolLogoMedia, 'profile_directory_card_1_1_'); + $schoolLogo = $this->entityTypeManager->getViewBuilder('media')->view($schoolLogoMedia, 'image_content_width'); } return [ From 0983c47ec781c54bca537ecbbe5e6c1f195e1846 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 11:46:39 -0500 Subject: [PATCH 28/88] fix(yalb-mega-footer): add social block --- .../ys_core/templates/ys-footer-block.html.twig | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 198532f5c4..08ce9196f2 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -30,20 +30,6 @@ site_footer__variation: 'mega', } %} -{# {% block site_footer_logos %} - - {% for logo in footer_logos %} - {% if logo.url %} -
- {% endif %} - {{ logo.logo }} - {% if logo.url %} - - {% endif %} - {% endfor %} - -{% endblock %} #} - {% block site_footer__logo %} {% if footer_logos.0.url %} @@ -101,6 +87,9 @@ {{footer_link_columns}} {% endblock %} {% endembed %} + + {{ drupal_block('social_links_block') }} + {% endblock %} {% endembed %} From 34dabd116aee23dd9f0b30bc3a43d923ccde933f Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 12:26:05 -0500 Subject: [PATCH 29/88] fix(yalb-mega-footer): add conditional in ys_core ys-footer-block.html.twig --- .../templates/ys-footer-block.html.twig | 132 +++++++++--------- 1 file changed, 69 insertions(+), 63 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 08ce9196f2..a21be70b8b 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -27,70 +27,76 @@ {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), - site_footer__variation: 'mega', -} %} - - {% block site_footer__logo %} - {% if footer_logos.0.url %} - - {% endif %} - {{ footer_logos.0.logo }} - {% if footer_logos.0.url %} - - {% endif %} - {% endblock %} - - {% block site_footer__logo_2 %} - {% if footer_logos.1.url %} - - {% endif %} - {{ footer_logos.1.logo }} - {% if footer_logos.1.url %} - - {% endif %} - {% endblock %} - - {% block site_footer__logo_3 %} - {% if footer_logos.2.url %} - - {% endif %} - {{ footer_logos.2.logo }} - {% if footer_logos.2.url %} - - {% endif %} - {% endblock %} - - {% block site_footer__logo_4 %} - {% if footer_logos.3.url %} - - {% endif %} - {{ footer_logos.3.logo }} - {% if footer_logos.3.url %} - - {% endif %} - {% endblock %} - - {% block site_footer__yale_logo %} - {{ school_logo }} - {% endblock %} - - {% block site_footer__content %} - {{ footer_text }} - {% endblock %} - - {% block site_footer__two_columns %} - {% embed "@molecules/link-group/yds-link-group.twig" with { - link_group__heading_one: footer_links_col_1_heading, - link_group__heading_two: footer_links_col_2_heading, - } %} - {% block link_group__links %} - {{footer_link_columns}} - {% endblock %} - {% endembed %} + site_footer__variation: 'basic', +}%} + {% if site_footer__variation == 'mega'%} + {% block site_footer__logo %} + {% if footer_logos.0.url %} + + {% endif %} + {{ footer_logos.0.logo }} + {% if footer_logos.0.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__logo_2 %} + {% if footer_logos.1.url %} + + {% endif %} + {{ footer_logos.1.logo }} + {% if footer_logos.1.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__logo_3 %} + {% if footer_logos.2.url %} + + {% endif %} + {{ footer_logos.2.logo }} + {% if footer_logos.2.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__logo_4 %} + {% if footer_logos.3.url %} + + {% endif %} + {{ footer_logos.3.logo }} + {% if footer_logos.3.url %} + + {% endif %} + {% endblock %} + + {% block site_footer__yale_logo %} + {{ school_logo }} + {% endblock %} + + {% block site_footer__content %} + {{ footer_text }} + {% endblock %} - {{ drupal_block('social_links_block') }} - - {% endblock %} + {% block site_footer__two_columns %} + {% embed "@molecules/link-group/yds-link-group.twig" with { + link_group__heading_one: footer_links_col_1_heading, + link_group__heading_two: footer_links_col_2_heading, + } %} + {% block link_group__links %} + {{footer_link_columns}} + {% endblock %} + {% endembed %} + + {{ drupal_block('social_links_block') }} + {% endblock %} + {% else %} + {% block site_footer__text %}{% endblock %} + {% block site_footer__columns %}{% endblock %} + {% block site_footer__social %} + {{ drupal_block('social_links_block') }} + {% endblock %} + {% endif %} {% endembed %} From fefb6e91f082ee20bc8eeb9c94765a3dc771b848 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 12:28:10 -0500 Subject: [PATCH 30/88] fix(yalb-mega-footer): add TODO to switch site_footer__variation to getThemeSetting function --- .../templates/ys-footer-block.html.twig | 47 +------------------ 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index a21be70b8b..406618a68d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -24,10 +24,11 @@ {% endif %} {% endset %} +{#TODO: set site_footer__variation to getThemeSetting('footer_variation')#} {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), - site_footer__variation: 'basic', + site_footer__variation: 'basic',; }%} {% if site_footer__variation == 'mega'%} {% block site_footer__logo %} @@ -87,7 +88,6 @@ {{footer_link_columns}} {% endblock %} {% endembed %} - {{ drupal_block('social_links_block') }} {% endblock %} {% else %} @@ -99,46 +99,3 @@ {% endif %} {% endembed %} - -{#

Mega Footer Block

- -
    -
  • Col 1 heading: {{ footer_links_col_1_heading }}
  • -
  • Col 2 heading: {{ footer_links_col_2_heading }}
  • -
  • Footer text: {{ footer_text }}
  • -
  • School logo: {{ school_logo }}
  • -
- -Footer logos: - - - -Footer links Col 1 - - -Footer links Col 2 - - -{{ drupal_block('social_links_block') }} #} From d4b2409b9ff61d9b059e62a644bb16f3e0bbd260 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 12:30:12 -0500 Subject: [PATCH 31/88] fix(yalb-mega-footer): add TODO to switch site_footer__variation to getThemeSetting function --- .../modules/custom/ys_core/templates/ys-footer-block.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 406618a68d..ee2e5bac2c 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -28,7 +28,7 @@ {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), - site_footer__variation: 'basic',; + site_footer__variation: 'basic', }%} {% if site_footer__variation == 'mega'%} {% block site_footer__logo %} From 12976c391e93dba8e79ede735b93fb2802042dc7 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 13:46:41 -0500 Subject: [PATCH 32/88] fix(yalb-mega-footer): make school logo single value --- .../modules/custom/ys_core/src/Form/FooterSettingsForm.php | 1 - 1 file changed, 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 5c3b6a98e9..9d4e0c8845 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -120,7 +120,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('School logo'), '#allowed_bundles' => ['image'], '#required' => FALSE, - '#cardinality' => 4, '#default_value' => ($footerConfig->get('content.school_logo')) ? $footerConfig->get('content.school_logo') : NULL, '#description' => $this->t('A horizontal logotype that is placed below the 4 logos on the left side of the footer.'), ]; From 973fff4ef511204fe982e4ae4c06c07ec91f939f Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 16:04:29 -0500 Subject: [PATCH 33/88] fix(yalb-mega-footer): wrap school logo in link --- .../templates/ys-footer-block.html.twig | 98 +++++++------------ 1 file changed, 35 insertions(+), 63 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index ee2e5bac2c..1dd17f0ca7 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,78 +1,30 @@ {# Set variable for all the links so we can reference them in a block below #} {% set link_group__base_class = 'link-group' %} -{% set footer_link_columns %} - {% if footer_links_col_1 %} -
    - {% for link in footer_links_col_1 %} - {% include "@molecules/link-group/_yds-link-group--links.twig" with { - link_group__link__url: link.link_url, - link_group__link__content: link.link_title, - }%} - {% endfor %} -
- {% endif %} - {% if footer_links_col_2 %} -
    - {% for link in footer_links_col_2 %} - {% include "@molecules/link-group/_yds-link-group--links.twig" with { - link_group__link__url: link.link_url, - link_group__link__content: link.link_title, - }%} - {% endfor %} -
- {% endif %} -{% endset %} {#TODO: set site_footer__variation to getThemeSetting('footer_variation')#} {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), - site_footer__variation: 'basic', + site_footer__variation: 'mega', }%} {% if site_footer__variation == 'mega'%} - {% block site_footer__logo %} - {% if footer_logos.0.url %} - - {% endif %} - {{ footer_logos.0.logo }} - {% if footer_logos.0.url %} - - {% endif %} - {% endblock %} - - {% block site_footer__logo_2 %} - {% if footer_logos.1.url %} - - {% endif %} - {{ footer_logos.1.logo }} - {% if footer_logos.1.url %} - - {% endif %} - {% endblock %} - - {% block site_footer__logo_3 %} - {% if footer_logos.2.url %} - - {% endif %} - {{ footer_logos.2.logo }} - {% if footer_logos.2.url %} - - {% endif %} - {% endblock %} - - {% block site_footer__logo_4 %} - {% if footer_logos.3.url %} - - {% endif %} - {{ footer_logos.3.logo }} - {% if footer_logos.3.url %} - - {% endif %} + {% block site_footer__logos %} + {% for logo in footer_logos %} + {% if logo.url %} + + {% endif %} + {{ logo.logo }} + {% if logo.url %} + + {% endif %} + {% endfor %} {% endblock %} {% block site_footer__yale_logo %} - {{ school_logo }} + + {{ school_logo }} + {% endblock %} {% block site_footer__content %} @@ -85,12 +37,32 @@ link_group__heading_two: footer_links_col_2_heading, } %} {% block link_group__links %} - {{footer_link_columns}} + {% if footer_links_col_1 %} +
    + {% for link in footer_links_col_1 %} + {% include "@molecules/link-group/_yds-link-group--links.twig" with { + link_group__link__url: link.link_url, + link_group__link__content: link.link_title, + }%} + {% endfor %} +
+ {% endif %} + {% if footer_links_col_2 %} +
    + {% for link in footer_links_col_2 %} + {% include "@molecules/link-group/_yds-link-group--links.twig" with { + link_group__link__url: link.link_url, + link_group__link__content: link.link_title, + }%} + {% endfor %} +
+ {% endif %} {% endblock %} {% endembed %} {{ drupal_block('social_links_block') }} {% endblock %} {% else %} + {# basic footer #} {% block site_footer__text %}{% endblock %} {% block site_footer__columns %}{% endblock %} {% block site_footer__social %} From 8b85c239df77fa047e0c48f5c21a11d7a8155fd8 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 16:34:47 -0500 Subject: [PATCH 34/88] fix(yalb-mega-footer): cleanup --- .../yalesites_profile/config/sync/captcha.settings.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml b/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml index de16739de7..1a9aa1b1f0 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml @@ -1,14 +1,14 @@ _core: default_config_hash: hSAUW7BoAd9YUpKcVKyZpW4wY67g4XZAYlt3Vnz6SVA +enabled_default: 0 default_challenge: recaptcha_v3/form_submission description: 'This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.' administration_mode: false +allow_on_admin_pages: false whitelist_ips: '' +add_captcha_description: true wrong_captcha_response_message: 'The answer you entered for the CAPTCHA was not correct.' default_validation: 1 persistence: 1 enable_stats: false log_wrong_responses: false -enabled_default: 0 -allow_on_admin_pages: false -add_captcha_description: true From 56f662fca26d0d6a6541bf93ca80d2a2c6684ae2 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 24 Aug 2023 16:55:40 -0500 Subject: [PATCH 35/88] fix(yalb-mega-footer): update logos responsive image style and sizes --- ...idth_212.yml => image.style.max_width_220.yml} | 6 +++--- .../config/sync/image.style.max_width_250.yml | 15 +++++++++++++++ .../sync/responsive_image.styles.image_logos.yml | 6 ++++-- 3 files changed, 22 insertions(+), 5 deletions(-) rename web/profiles/custom/yalesites_profile/config/sync/{image.style.max_width_212.yml => image.style.max_width_220.yml} (81%) create mode 100644 web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_250.yml diff --git a/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_212.yml b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_220.yml similarity index 81% rename from web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_212.yml rename to web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_220.yml index 8582a2c23a..aeae3933b9 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_212.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_220.yml @@ -2,14 +2,14 @@ uuid: cc474f99-212c-426f-a9de-422e27b95aba langcode: en status: true dependencies: { } -name: max_width_212 -label: 'Max-width (212)' +name: max_width_220 +label: 'Max-width (220)' effects: a30e1716-3d94-4a36-af44-37e9dc68f061: uuid: a30e1716-3d94-4a36-af44-37e9dc68f061 id: image_scale weight: 1 data: - width: 212 + width: 220 height: null upscale: false diff --git a/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_250.yml b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_250.yml new file mode 100644 index 0000000000..6bdf4dcd6f --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/image.style.max_width_250.yml @@ -0,0 +1,15 @@ +uuid: 659db156-c9f5-4fbe-8821-9e49d858f815 +langcode: en +status: true +dependencies: { } +name: max_width_250 +label: 'Max-width (250)' +effects: + 61e4e086-8b5f-480c-87ef-0ae6aa853658: + uuid: 61e4e086-8b5f-480c-87ef-0ae6aa853658 + id: image_scale + weight: 1 + data: + width: 250 + height: null + upscale: false diff --git a/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml b/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml index a5a2da8e09..af2021a991 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/responsive_image.styles.image_logos.yml @@ -4,7 +4,8 @@ status: true dependencies: config: - image.style.max_width_180 - - image.style.max_width_212 + - image.style.max_width_220 + - image.style.max_width_250 - image.style.max_width_320 - image.style.max_width_444 - image.style.max_width_480 @@ -19,8 +20,9 @@ image_style_mappings: image_mapping: sizes: '(min-width: 1344px) 212px, (min-width: 992px) 180px, (min-width: 576px) 25vw, 50vw' sizes_image_styles: + - max_width_250 - max_width_180 - - max_width_212 + - max_width_220 - max_width_320 - max_width_444 - max_width_480 From 89573075d60dba1a9779e4d5bd4bd4f270db4b80 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 24 Aug 2023 16:03:38 -0700 Subject: [PATCH 36/88] feat(YALB-1510): Refactor main menu first links to allow for headings for better clarity --- .../modules/custom/ys_core/ys_core.module | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index eba06c102e..d6182776be 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -101,6 +101,12 @@ function ys_core_form_alter(&$form, $form_state, $form_id) { '#markup' => "

" . t('@description', $replacements) . "

", ]; } + + // Alter description/placeholder to be used for new first level heading link. + if ($form_id == 'menu_link_content_menu_link_content_form') { + $form['description']['widget'][0]['value']['#description'] = t('Top level main menu links will use this as the CTA text on the left side.'); + $form['description']['widget'][0]['value']['#placeholder'] = t('Explore all'); + } } /** @@ -159,13 +165,12 @@ function ys_core_preprocess_menu__main(&$variables) { // We don't want any other subitems, just the top level. $clonedMenuItem['below'] = NULL; - // If a node, use the node title instead of link title. - $routeParams = $clonedMenuItem['original_link']->getRouteParameters(); - if (!empty($routeParams['node'])) { - /** @var \Drupal\node\Entity\Node $node */ - $node = \Drupal::entityTypeManager()->getStorage('node')->load($routeParams['node']); - $clonedMenuItem['title'] = $node->getTitle(); - } + // Main menu items get the heading treatment. + // @see component-library-twig/components/02-molecules/menu/_yds-menu-item.twig + $clonedMenuItem['is_heading'] = TRUE; + + // Get the description in the menu item to use as the CTA. + $clonedMenuItem['heading_cta'] = ($clonedMenuItem['original_link']->getDescription()) ?? t('Explore all'); // Add cloned item to the beginning of the menu. array_unshift($menuItem['below'], $clonedMenuItem); From a284d1100bd21bef2a1b05d995864910570b46e1 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 24 Aug 2023 18:02:21 -0700 Subject: [PATCH 37/88] feat(YALB-1488): WIP Add variation toggle, fix pathAuto URLs, start work on responsive image styles --- .../install/ys_core.footer_settings.yml | 1 + .../ys_core/src/Form/FooterSettingsForm.php | 66 +++++++++++++++++-- .../src/Plugin/Block/YaleSitesFooterBlock.php | 15 +++-- .../templates/ys-footer-block.html.twig | 5 +- .../modules/custom/ys_core/ys_core.module | 1 + 5 files changed, 75 insertions(+), 13 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml index 3f5fb796b1..343c423804 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml @@ -1,3 +1,4 @@ +footer_variation: 'basic' content: logos: [] school_logo: '' diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 9d4e0c8845..787ed603ef 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -6,6 +6,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\path_alias\AliasManager; use Drupal\ys_core\SocialLinksManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -37,6 +38,13 @@ public function getFormId() { */ protected $socialLinks; + /** + * The path alias manager. + * + * @var \Drupal\path_alias\AliasManager + */ + protected $pathAliasManager; + /** * Settings configuration form. * @@ -90,6 +98,18 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#group' => 'footer_tabs', ]; + $form['footer_variation'] = [ + '#type' => 'radios', + '#options' => [ + 'basic' => $this->t('Basic - displays only the social links.'), + 'mega' => $this->t('Mega - displays all of the fields listed below.'), + ], + '#title' => $this->t('Footer variation'), + '#description' => $this->t('All variations display Yale branding, accessibility and privacy links, and copyright information.'), + '#default_value' => ($footerConfig->get('footer_variation')) ? $footerConfig->get('footer_variation') : 'basic', + '#weight' => -1, + ]; + $form['footer_logos']['logos'] = [ '#type' => 'multivalue', '#title' => $this->t('Footer Logos'), @@ -219,16 +239,35 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } $socialConfig->save(); + $linksCol1 = $linksCol2 = $logoLinks = []; + + // Translate node links. + foreach ($form_state->getValue('links_col_1') as $key => $link) { + $linksCol1[$key]['link_url'] = $this->translateNodeLinks($link['link_url']); + $linksCol1[$key]['link_title'] = $link['link_title']; + } + + foreach ($form_state->getValue('links_col_2') as $key => $link) { + $linksCol2[$key]['link_url'] = $this->translateNodeLinks($link['link_url']); + $linksCol2[$key]['link_title'] = $link['link_title']; + } + + foreach ($form_state->getValue('logos') as $key => $logo) { + $logoLinks[$key]['logo_url'] = $this->translateNodeLinks($logo['logo_url']); + $logoLinks[$key]['logo'] = $logo['logo']; + } + // Footer settings config. $footerConfig = $this->config('ys_core.footer_settings'); - $footerConfig->set('content.logos', $form_state->getValue('logos')); + $footerConfig->set('footer_variation', $form_state->getValue('footer_variation')); + $footerConfig->set('content.logos', $logoLinks); $footerConfig->set('content.school_logo', $form_state->getValue('school_logo')); $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); $footerConfig->set('links.links_col_2_heading', $form_state->getValue('links_col_2_heading')); - $footerConfig->set('links.links_col_1', $form_state->getValue('links_col_1')); - $footerConfig->set('links.links_col_2', $form_state->getValue('links_col_2')); + $footerConfig->set('links.links_col_1', $linksCol1); + $footerConfig->set('links.links_col_2', $linksCol2); $footerConfig->save(); @@ -253,7 +292,8 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('cache.render'), - $container->get('ys_core.social_links_manager') + $container->get('ys_core.social_links_manager'), + $container->get('path_alias.manager'), ); } @@ -266,11 +306,19 @@ public static function create(ContainerInterface $container) { * The Cache backend interface. * @param \Drupal\ys_core\SocialLinksManager $social_links_manager * The Yale social media links management service. + * @param \Drupal\path_alias\AliasManager $path_alias_manager + * The Path Alias Manager. */ - public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $cache_render, SocialLinksManager $social_links_manager) { + public function __construct( + ConfigFactoryInterface $config_factory, + CacheBackendInterface $cache_render, + SocialLinksManager $social_links_manager, + AliasManager $path_alias_manager, + ) { parent::__construct($config_factory); $this->cacheRender = $cache_render; $this->socialLinks = $social_links_manager; + $this->pathAliasManager = $path_alias_manager; } /** @@ -295,4 +343,12 @@ protected function validateFooterLinks($form_state, $field_id) { } } + protected function translateNodeLinks($link) { + // If link URL is an internal path, use the path alias instead. + if (!str_starts_with($link, "http")) { + $linkPath = $this->pathAliasManager->getAliasByPath($link); + return $linkPath; + } + } + } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index fcf35bbe47..c8bbffb089 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -76,6 +76,7 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function build() { + $fileEntity = $this->entityTypeManager->getStorage('file'); $footerLogos = []; foreach ($this->footerSettings->get('content.logos') as $key => $logoData) { @@ -84,18 +85,22 @@ public function build() { $footerLogos[$key]['url'] = $logoData['logo_url']; } - $schoolLogoId = $this->footerSettings->get('content.school_logo'); - $schoolLogo = []; + $schoolLogoFileUri = NULL; - if ($schoolLogoId) { + if ($schoolLogoId = $this->footerSettings->get('content.school_logo')) { $schoolLogoMedia = $this->entityTypeManager->getStorage('media')->load($schoolLogoId); - $schoolLogo = $this->entityTypeManager->getViewBuilder('media')->view($schoolLogoMedia, 'image_content_width'); + $schoolLogoFileUri = $fileEntity->load($schoolLogoMedia->field_media_image->target_id)->getFileUri(); } return [ '#theme' => 'ys_footer_block', + '#footer_variation' => $this->footerSettings->get('footer_variation'), '#footer_logos' => $footerLogos, - '#school_logo' => $schoolLogo, + // '#school_logo' => [ + // '#type' => 'responsive_image', + // '#responsive_image_style_id' => 'image_content_width', + // //'#uri' => $schoolLogoFileUri, + // ], '#footer_text' => [ '#type' => 'processed_text', '#text' => $this->footerSettings->get('content.text')['value'], diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 1dd17f0ca7..3e65996a03 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,12 +1,11 @@ {# Set variable for all the links so we can reference them in a block below #} {% set link_group__base_class = 'link-group' %} - {#TODO: set site_footer__variation to getThemeSetting('footer_variation')#} {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), - site_footer__variation: 'mega', + site_footer__variation: footer_variation|default('basic'), }%} {% if site_footer__variation == 'mega'%} {% block site_footer__logos %} @@ -30,7 +29,7 @@ {% block site_footer__content %} {{ footer_text }} {% endblock %} - + {% block site_footer__two_columns %} {% embed "@molecules/link-group/yds-link-group.twig" with { link_group__heading_one: footer_links_col_1_heading, diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index 56fff6b967..20201b4792 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -55,6 +55,7 @@ function ys_core_theme($existing, $type, $theme, $path): array { ], 'ys_footer_block' => [ 'variables' => [ + 'footer_variation' => 'basic', 'footer_logos' => [], 'school_logo' => NULL, 'footer_text' => NULL, From 2d0cbfc87aaea2c7b957ad0fb03af754c845c5c6 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Fri, 25 Aug 2023 11:50:47 -0700 Subject: [PATCH 38/88] feat(YALB-1488): Change images to use responsive image styles --- .../sync/block.block.yalesitesfooterblock.yml | 20 +++++++++++ .../ys_core/src/Form/FooterSettingsForm.php | 20 ++++++++--- .../src/Plugin/Block/YaleSitesFooterBlock.php | 36 ++++++++++++------- .../templates/ys-footer-block.html.twig | 8 +++-- 4 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/config/sync/block.block.yalesitesfooterblock.yml diff --git a/web/profiles/custom/yalesites_profile/config/sync/block.block.yalesitesfooterblock.yml b/web/profiles/custom/yalesites_profile/config/sync/block.block.yalesitesfooterblock.yml new file mode 100644 index 0000000000..4c479855ea --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/block.block.yalesitesfooterblock.yml @@ -0,0 +1,20 @@ +uuid: 4d9a3d30-51e9-4057-9f6d-99b22f6e367b +langcode: en +status: true +dependencies: + module: + - ys_core + theme: + - atomic +id: yalesitesfooterblock +theme: atomic +region: footer +weight: 0 +provider: null +plugin: ys_footer_block +settings: + id: ys_footer_block + label: 'YaleSites Footer Block' + label_display: '0' + provider: ys_core +visibility: { } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 787ed603ef..20dda9df80 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -243,17 +243,21 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Translate node links. foreach ($form_state->getValue('links_col_1') as $key => $link) { - $linksCol1[$key]['link_url'] = $this->translateNodeLinks($link['link_url']); - $linksCol1[$key]['link_title'] = $link['link_title']; + if ($link['link_url']) { + $linksCol1[$key]['link_url'] = $this->translateNodeLinks($link['link_url']); + $linksCol1[$key]['link_title'] = $link['link_title']; + } } foreach ($form_state->getValue('links_col_2') as $key => $link) { - $linksCol2[$key]['link_url'] = $this->translateNodeLinks($link['link_url']); - $linksCol2[$key]['link_title'] = $link['link_title']; + if ($link['link_url']) { + $linksCol2[$key]['link_url'] = $this->translateNodeLinks($link['link_url']); + $linksCol2[$key]['link_title'] = $link['link_title']; + } } foreach ($form_state->getValue('logos') as $key => $logo) { - $logoLinks[$key]['logo_url'] = $this->translateNodeLinks($logo['logo_url']); + $logoLinks[$key]['logo_url'] = $logo['logo_url'] ? $this->translateNodeLinks($logo['logo_url']) : NULL; $logoLinks[$key]['logo'] = $logo['logo']; } @@ -343,6 +347,12 @@ protected function validateFooterLinks($form_state, $field_id) { } } + /** + * Translate internal node links to path links. + * + * @param string $link + * The path entered from the form. + */ protected function translateNodeLinks($link) { // If link URL is an internal path, use the path alias instead. if (!str_starts_with($link, "http")) { diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index c8bbffb089..c3400892e8 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -77,30 +77,38 @@ public static function create(ContainerInterface $container, array $configuratio */ public function build() { $fileEntity = $this->entityTypeManager->getStorage('file'); - $footerLogos = []; + $footerLogosRender = $schoolLogoRender = []; + // Responsive image render array for logos. foreach ($this->footerSettings->get('content.logos') as $key => $logoData) { - $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoData['logo']); - $footerLogos[$key]['logo'] = $this->entityTypeManager->getViewBuilder('media')->view($footerLogoMedia, 'image_logos'); - $footerLogos[$key]['url'] = $logoData['logo_url']; + if ($logoData['logo']) { + $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoData['logo']); + $footerLogoFileUri = $fileEntity->load($footerLogoMedia->field_media_image->target_id)->getFileUri(); + $footerLogosRender[$key]['url'] = $logoData['logo_url'] ?? NULL; + $footerLogosRender[$key]['logo'] = [ + '#type' => 'responsive_image', + '#responsive_image_style_id' => 'image_logos', + '#uri' => $footerLogoFileUri, + ]; + } } - $schoolLogoFileUri = NULL; - + // Responsive image render array for school logo. if ($schoolLogoId = $this->footerSettings->get('content.school_logo')) { $schoolLogoMedia = $this->entityTypeManager->getStorage('media')->load($schoolLogoId); $schoolLogoFileUri = $fileEntity->load($schoolLogoMedia->field_media_image->target_id)->getFileUri(); + $schoolLogoRender = [ + '#type' => 'responsive_image', + '#responsive_image_style_id' => 'image_content_width', + '#uri' => $schoolLogoFileUri, + ]; } - return [ + $footerBlockRender = [ '#theme' => 'ys_footer_block', '#footer_variation' => $this->footerSettings->get('footer_variation'), - '#footer_logos' => $footerLogos, - // '#school_logo' => [ - // '#type' => 'responsive_image', - // '#responsive_image_style_id' => 'image_content_width', - // //'#uri' => $schoolLogoFileUri, - // ], + '#footer_logos' => $footerLogosRender, + '#school_logo' => $schoolLogoRender, '#footer_text' => [ '#type' => 'processed_text', '#text' => $this->footerSettings->get('content.text')['value'], @@ -111,6 +119,8 @@ public function build() { '#footer_links_col_1' => $this->footerSettings->get('links.links_col_1'), '#footer_links_col_2' => $this->footerSettings->get('links.links_col_2'), ]; + + return $footerBlockRender; } } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 3e65996a03..24bd53489a 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -21,9 +21,11 @@ {% endblock %} {% block site_footer__yale_logo %} - - {{ school_logo }} - + {% if school_logo %} + + {{ school_logo }} + + {% endif %} {% endblock %} {% block site_footer__content %} From 80a729ef56441bbd99f695254bb921b59de00671 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Mon, 28 Aug 2023 14:08:52 -0700 Subject: [PATCH 39/88] fix(YALB-1485): Fix issue when no logos are supplied. --- .../src/Plugin/Block/YaleSitesFooterBlock.php | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index c3400892e8..ffe6f7166b 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -80,16 +80,18 @@ public function build() { $footerLogosRender = $schoolLogoRender = []; // Responsive image render array for logos. - foreach ($this->footerSettings->get('content.logos') as $key => $logoData) { - if ($logoData['logo']) { - $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoData['logo']); - $footerLogoFileUri = $fileEntity->load($footerLogoMedia->field_media_image->target_id)->getFileUri(); - $footerLogosRender[$key]['url'] = $logoData['logo_url'] ?? NULL; - $footerLogosRender[$key]['logo'] = [ - '#type' => 'responsive_image', - '#responsive_image_style_id' => 'image_logos', - '#uri' => $footerLogoFileUri, - ]; + if ($footerLogosConfig = $this->footerSettings->get('content.logos')) { + foreach ($footerLogosConfig as $key => $logoData) { + if ($logoData['logo']) { + $footerLogoMedia = $this->entityTypeManager->getStorage('media')->load($logoData['logo']); + $footerLogoFileUri = $fileEntity->load($footerLogoMedia->field_media_image->target_id)->getFileUri(); + $footerLogosRender[$key]['url'] = $logoData['logo_url'] ?? NULL; + $footerLogosRender[$key]['logo'] = [ + '#type' => 'responsive_image', + '#responsive_image_style_id' => 'image_logos', + '#uri' => $footerLogoFileUri, + ]; + } } } @@ -111,7 +113,7 @@ public function build() { '#school_logo' => $schoolLogoRender, '#footer_text' => [ '#type' => 'processed_text', - '#text' => $this->footerSettings->get('content.text')['value'], + '#text' => $this->footerSettings->get('content.text')['value'] ?? NULL, '#format' => 'restricted_html', ], '#footer_links_col_1_heading' => $this->footerSettings->get('links.links_col_1_heading'), From 9eb5434be46ef9240e8e1860ae99f12929e6e979 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Mon, 28 Aug 2023 16:38:53 -0500 Subject: [PATCH 40/88] fix(yalb-mega-footer): add bg color for legend --- web/themes/custom/ys_admin_theme/css/gin-custom.css | 7 +++++++ web/themes/custom/ys_admin_theme/css/gin-custom.css.map | 2 +- web/themes/custom/ys_admin_theme/scss/gin-custom.scss | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/web/themes/custom/ys_admin_theme/css/gin-custom.css b/web/themes/custom/ys_admin_theme/css/gin-custom.css index b699500111..156c0b0d25 100644 --- a/web/themes/custom/ys_admin_theme/css/gin-custom.css +++ b/web/themes/custom/ys_admin_theme/css/gin-custom.css @@ -295,6 +295,13 @@ background-color: var(--darkest-gray) !important; } +/* Legend */ +.gin--dark-mode .fieldset-legend.fieldset__label { + background-color: var(--darkest-gray); + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; +} + /* stylelint-enable */ /*# sourceMappingURL=gin-custom.css.map */ diff --git a/web/themes/custom/ys_admin_theme/css/gin-custom.css.map b/web/themes/custom/ys_admin_theme/css/gin-custom.css.map index d5014cbef6..8ce3b62887 100644 --- a/web/themes/custom/ys_admin_theme/css/gin-custom.css.map +++ b/web/themes/custom/ys_admin_theme/css/gin-custom.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../scss/gin-custom.scss"],"names":[],"mappings":"AAAA;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;;;AAIJ;EACE;EACA;;;AAIF;EACE;;;AAIF;EACE;;;AAGF;EACE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAQE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAmCE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAIF;AAAA;EAEE;;;AAIF;EACE;;;AAIF;EACE;;;AAMF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;EACA;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AACA;EACE;EACA;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;;;AAQF;AACA;EACE;EACA;;;AAKF;EACE;;;AAGF;EACE;EACA;;;AAIF;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAEF;EACE;EACA;;;AAKF;AAAA;EAEE;EACA;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;AACA;EACE;;;AAGF","file":"gin-custom.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../scss/gin-custom.scss"],"names":[],"mappings":"AAAA;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;;;AAIJ;EACE;EACA;;;AAIF;EACE;;;AAIF;EACE;;;AAGF;EACE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAQE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAmCE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAIF;AAAA;EAEE;;;AAIF;EACE;;;AAIF;EACE;;;AAMF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;EACA;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AACA;EACE;EACA;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;;;AAQF;AACA;EACE;EACA;;;AAKF;EACE;;;AAGF;EACE;EACA;;;AAIF;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAEF;EACE;EACA;;;AAKF;AAAA;EAEE;EACA;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;EACA;EACA;;;AAGF","file":"gin-custom.css"} \ No newline at end of file diff --git a/web/themes/custom/ys_admin_theme/scss/gin-custom.scss b/web/themes/custom/ys_admin_theme/scss/gin-custom.scss index 4649da1861..6d560a6e60 100644 --- a/web/themes/custom/ys_admin_theme/scss/gin-custom.scss +++ b/web/themes/custom/ys_admin_theme/scss/gin-custom.scss @@ -316,4 +316,11 @@ background-color: var(--darkest-gray) !important; } +/* Legend */ +.gin--dark-mode .fieldset-legend.fieldset__label { + background-color: var(--darkest-gray); + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; +} + /* stylelint-enable */ From c447ae078def363bed963469fd50cc6c17060de5 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Mon, 28 Aug 2023 15:03:41 -0700 Subject: [PATCH 41/88] feat(YALB-1285): Add school logo URL with fallback --- .../install/ys_core.footer_settings.yml | 1 + .../ys_core/src/Form/FooterSettingsForm.php | 24 ++++++++++++++++++- .../src/Plugin/Block/YaleSitesFooterBlock.php | 1 + .../templates/ys-footer-block.html.twig | 3 ++- .../modules/custom/ys_core/ys_core.module | 1 + 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml index 343c423804..f697a99584 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/config/install/ys_core.footer_settings.yml @@ -2,6 +2,7 @@ footer_variation: 'basic' content: logos: [] school_logo: '' + school_logo_url: '' text: [] links: links_col_1_heading: '' diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 20dda9df80..47a0e8fa54 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -135,7 +135,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { ]; - $form['footer_logos']['school_logo'] = [ + $form['footer_logos']['school_logo_group'] = [ + '#type' => 'fieldset', + '#title' => $this->t('School Logo'), + ]; + + $form['footer_logos']['school_logo_group']['school_logo'] = [ '#type' => 'media_library', '#title' => $this->t('School logo'), '#allowed_bundles' => ['image'], @@ -144,6 +149,17 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('A horizontal logotype that is placed below the 4 logos on the left side of the footer.'), ]; + $form['footer_logos']['school_logo_group']['school_logo_url'] = [ + '#type' => 'linkit', + '#title' => $this->t('School logo URL'), + '#description' => $this->t('Type the URL or autocomplete for internal paths.'), + '#autocomplete_route_name' => 'linkit.autocomplete', + '#autocomplete_route_parameters' => [ + 'linkit_profile_id' => 'default', + ], + '#default_value' => ($footerConfig->get('content.school_logo_url')) ? $footerConfig->get('content.school_logo_url') : '/', + ]; + $form['footer_content']['footer_text'] = [ '#type' => 'text_format', '#title' => $this->t('Text Content'), @@ -240,6 +256,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $socialConfig->save(); $linksCol1 = $linksCol2 = $logoLinks = []; + $schoolLogoLink = NULL; // Translate node links. foreach ($form_state->getValue('links_col_1') as $key => $link) { @@ -261,12 +278,17 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $logoLinks[$key]['logo'] = $logo['logo']; } + if ($schoolLogoLink = $form_state->getValue('school_logo_url')) { + $schoolLogoLink = $this->translateNodeLinks($schoolLogoLink); + } + // Footer settings config. $footerConfig = $this->config('ys_core.footer_settings'); $footerConfig->set('footer_variation', $form_state->getValue('footer_variation')); $footerConfig->set('content.logos', $logoLinks); $footerConfig->set('content.school_logo', $form_state->getValue('school_logo')); + $footerConfig->set('content.school_logo_url', $schoolLogoLink); $footerConfig->set('content.text', $form_state->getValue('footer_text')); $footerConfig->set('links.links_col_1_heading', $form_state->getValue('links_col_1_heading')); $footerConfig->set('links.links_col_2_heading', $form_state->getValue('links_col_2_heading')); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index ffe6f7166b..6128a6064e 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -111,6 +111,7 @@ public function build() { '#footer_variation' => $this->footerSettings->get('footer_variation'), '#footer_logos' => $footerLogosRender, '#school_logo' => $schoolLogoRender, + '#school_logo_url' => $this->footerSettings->get('content.school_logo_url'), '#footer_text' => [ '#type' => 'processed_text', '#text' => $this->footerSettings->get('content.text')['value'] ?? NULL, diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 24bd53489a..7eb4a6adea 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -1,5 +1,6 @@ {# Set variable for all the links so we can reference them in a block below #} {% set link_group__base_class = 'link-group' %} +{% set school_logo_url = school_logo_url|default('/') %} {#TODO: set site_footer__variation to getThemeSetting('footer_variation')#} {% embed "@organisms/site-footer/yds-site-footer.twig" with { @@ -22,7 +23,7 @@ {% block site_footer__yale_logo %} {% if school_logo %} - + {{ school_logo }} {% endif %} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index 054d2cefdd..044b47f57c 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -59,6 +59,7 @@ function ys_core_theme($existing, $type, $theme, $path): array { 'footer_variation' => 'basic', 'footer_logos' => [], 'school_logo' => NULL, + 'school_logo_url' => '/', 'footer_text' => NULL, 'footer_links_col_1_heading' => NULL, 'footer_links_col_2_heading' => NULL, From a10ec24930cd1609b12e44b3726316dc524e8520 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Mon, 28 Aug 2023 15:22:01 -0700 Subject: [PATCH 42/88] fix(YALB-1485): Fix linting error --- .../yalesites_profile/modules/custom/ys_core/ys_core.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index 044b47f57c..5e41778d06 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -65,7 +65,7 @@ function ys_core_theme($existing, $type, $theme, $path): array { 'footer_links_col_2_heading' => NULL, 'footer_links_col_1' => [], 'footer_links_col_2' => [], - ] + ], ], ]; } From e1983c6cd92ddc03f828bc81c64396d899d72487 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Mon, 28 Aug 2023 16:16:44 -0700 Subject: [PATCH 43/88] fix(YALB-1485): Fix accessibility aria describedby issue --- .../modules/custom/ys_core/src/Form/FooterSettingsForm.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 47a0e8fa54..cfdfe750e6 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -140,13 +140,17 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('School Logo'), ]; + $form['footer_logos']['school_logo_group']['aria-description'] = [ + '#type' => 'markup', + '#markup' => "
A horizontal logotype that is placed below the 4 logos on the left side of the footer.
", + ]; + $form['footer_logos']['school_logo_group']['school_logo'] = [ '#type' => 'media_library', '#title' => $this->t('School logo'), '#allowed_bundles' => ['image'], '#required' => FALSE, '#default_value' => ($footerConfig->get('content.school_logo')) ? $footerConfig->get('content.school_logo') : NULL, - '#description' => $this->t('A horizontal logotype that is placed below the 4 logos on the left side of the footer.'), ]; $form['footer_logos']['school_logo_group']['school_logo_url'] = [ From e9c549f6e8d68f92d1cd3b0f53f57127b1e69720 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Mon, 28 Aug 2023 16:30:46 -0700 Subject: [PATCH 44/88] fix(YALB-1485): Add alt text to logos --- .../ys_core/src/Plugin/Block/YaleSitesFooterBlock.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php index 6128a6064e..042616079d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Plugin/Block/YaleSitesFooterBlock.php @@ -90,6 +90,9 @@ public function build() { '#type' => 'responsive_image', '#responsive_image_style_id' => 'image_logos', '#uri' => $footerLogoFileUri, + '#attributes' => [ + 'alt' => $footerLogoMedia->get('field_media_image')->first()->get('alt')->getValue(), + ], ]; } } @@ -103,6 +106,9 @@ public function build() { '#type' => 'responsive_image', '#responsive_image_style_id' => 'image_content_width', '#uri' => $schoolLogoFileUri, + '#attributes' => [ + 'alt' => $schoolLogoMedia->get('field_media_image')->first()->get('alt')->getValue(), + ], ]; } From 205317dbe655ecac95856aca065bba96e9667646 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Tue, 29 Aug 2023 12:35:30 -0500 Subject: [PATCH 45/88] fix(yalb-mega-footer): update legend styles --- .../custom/ys_admin_theme/css/gin-custom.css | 25 ++++++++++++++++++- .../ys_admin_theme/css/gin-custom.css.map | 2 +- .../ys_admin_theme/scss/gin-custom.scss | 25 ++++++++++++++++++- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/web/themes/custom/ys_admin_theme/css/gin-custom.css b/web/themes/custom/ys_admin_theme/css/gin-custom.css index 148517d836..f4418d54b5 100644 --- a/web/themes/custom/ys_admin_theme/css/gin-custom.css +++ b/web/themes/custom/ys_admin_theme/css/gin-custom.css @@ -295,10 +295,33 @@ } /* Legend */ +.gin--dark-mode legend { + display: block; + margin: 0; + border: 0; + padding: 0; + width: 100%; +} + .gin--dark-mode .fieldset-legend.fieldset__label { - background-color: var(--darkest-gray); + display: block; + color: var(--darkest-gray); + background-color: var(--wool); border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + border: 0.15rem solid var(--gin-border-color); + margin-left: -0.15rem; + margin-right: -0.15rem; +} + +.gin--dark-mode #edit-footer-logos .fieldset-wrapper { + padding: 1rem; +} + +.gin--dark-mode #edit-footer-logos fieldset + .form-item { + margin-top: 1rem; } /* Danger button */ diff --git a/web/themes/custom/ys_admin_theme/css/gin-custom.css.map b/web/themes/custom/ys_admin_theme/css/gin-custom.css.map index a88eea834c..f629da64eb 100644 --- a/web/themes/custom/ys_admin_theme/css/gin-custom.css.map +++ b/web/themes/custom/ys_admin_theme/css/gin-custom.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../scss/gin-custom.scss"],"names":[],"mappings":"AAAA;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;;;AAIJ;EACE;EACA;;;AAIF;EACE;;;AAIF;EACE;;;AAGF;EACE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAQE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAmCE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAIF;AAAA;EAEE;;;AAIF;EACE;;;AAIF;EACE;;;AAMF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;EACA;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;;;AAGF;AACA;EACE;EACA;;;AAKF;EACE;;;AAGF;EACE;EACA;;;AAIF;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAEF;EACE;EACA;;;AAKF;AAAA;EAEE;EACA;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;EACA;EACA;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF","file":"gin-custom.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../scss/gin-custom.scss"],"names":[],"mappings":"AAAA;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;;;AAIJ;EACE;EACA;;;AAIF;EACE;;;AAIF;EACE;;;AAGF;EACE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAQE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAmCE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAIF;AAAA;EAEE;;;AAIF;EACE;;;AAIF;EACE;;;AAMF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAUE;EACA;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;AAAA;EAEE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;;;AAGF;AACA;EACE;EACA;;;AAKF;EACE;;;AAGF;EACE;EACA;;;AAIF;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAEF;EACE;EACA;;;AAKF;AAAA;EAEE;EACA;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;AACA;EACE;;;AAGF;AACA;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;;;AAGF","file":"gin-custom.css"} \ No newline at end of file diff --git a/web/themes/custom/ys_admin_theme/scss/gin-custom.scss b/web/themes/custom/ys_admin_theme/scss/gin-custom.scss index cf1205d0dd..ffb7d71054 100644 --- a/web/themes/custom/ys_admin_theme/scss/gin-custom.scss +++ b/web/themes/custom/ys_admin_theme/scss/gin-custom.scss @@ -311,10 +311,33 @@ } /* Legend */ +.gin--dark-mode legend { + display: block; + margin: 0; + border: 0; + padding: 0; + width: 100%; +} + .gin--dark-mode .fieldset-legend.fieldset__label { - background-color: var(--darkest-gray); + display: block; + color: var(--darkest-gray); + background-color: var(--wool); border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + border: 0.15rem solid var(--gin-border-color); + margin-left: -0.15rem; + margin-right: -0.15rem; +} + +.gin--dark-mode #edit-footer-logos .fieldset-wrapper { + padding: 1rem; +} + +.gin--dark-mode #edit-footer-logos fieldset + .form-item { + margin-top: 1rem; } /* Danger button */ From 62070235cf62ec3ce0b267f036c0be1caf510f2c Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 29 Aug 2023 11:28:41 -0700 Subject: [PATCH 46/88] fix(YALB-1485): Fix external links for logos and links --- .../ys_core/src/Form/FooterSettingsForm.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index cfdfe750e6..7af57fb748 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -263,6 +263,16 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $schoolLogoLink = NULL; // Translate node links. + foreach ($form_state->getValue('logos') as $key => $logo) { + + $logoLinks[$key]['logo_url'] = $logo['logo_url'] ? $this->translateNodeLinks($logo['logo_url']) : NULL; + $logoLinks[$key]['logo'] = $logo['logo']; + } + + if ($schoolLogoLink = $form_state->getValue('school_logo_url')) { + $schoolLogoLink = $this->translateNodeLinks($schoolLogoLink); + } + foreach ($form_state->getValue('links_col_1') as $key => $link) { if ($link['link_url']) { $linksCol1[$key]['link_url'] = $this->translateNodeLinks($link['link_url']); @@ -277,15 +287,6 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } } - foreach ($form_state->getValue('logos') as $key => $logo) { - $logoLinks[$key]['logo_url'] = $logo['logo_url'] ? $this->translateNodeLinks($logo['logo_url']) : NULL; - $logoLinks[$key]['logo'] = $logo['logo']; - } - - if ($schoolLogoLink = $form_state->getValue('school_logo_url')) { - $schoolLogoLink = $this->translateNodeLinks($schoolLogoLink); - } - // Footer settings config. $footerConfig = $this->config('ys_core.footer_settings'); @@ -381,10 +382,8 @@ protected function validateFooterLinks($form_state, $field_id) { */ protected function translateNodeLinks($link) { // If link URL is an internal path, use the path alias instead. - if (!str_starts_with($link, "http")) { - $linkPath = $this->pathAliasManager->getAliasByPath($link); - return $linkPath; - } + $link = (str_starts_with($link, "/node")) ? $this->pathAliasManager->getAliasByPath($link) : $link; + return $link; } } From 7ebea21b72d80bf3d47f3572fbdedd66d98ac63f Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Tue, 29 Aug 2023 15:12:09 -0500 Subject: [PATCH 47/88] fix(yalb-1312): update views-basic with more radio elements for checked state visual feedback, add temporary styles for event period --- .../ys_views_basic/assets/css/views-basic.css | 48 ++++++++++++++----- .../ys_views_basic/assets/js/views-basic.js | 27 ++++++----- 2 files changed, 49 insertions(+), 26 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css index 4eaec6da7e..a1cd61e146 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css @@ -4,13 +4,13 @@ /* set variables */ .layout-builder-configure-block { - --color-border: var(--color-gray-500); + --color-border: var(--wool); --color-border-lightest: var(--color-basic-white); --color-link-hover: hsl(210, 100%, 21%); - --color-link-border: hsl(213, 66%, 45%); + --color-link-border: #187e9b; --color-background-primary: var(--color-basic-white); - --color-background-hover: var(--wool); - --color-border-hover: hsl(213, 66%, 45%); + --color-background-hover: var(--dark-theme-gray); + --color-border-hover: var(--darkest-gray); --color-text-lighter: #2D424D; --color-text-primary: var(--color-gray-800); } @@ -69,7 +69,7 @@ aspect-ratio: 2/1; display: block !important; text-align: left; - background: var(--color-basic-white); + background: var(--dark-theme-gray); border: 2px solid var(--color-border); padding: var(--size-spacing-4) var(--size-spacing-5); color: var(--color-text-primary); @@ -147,14 +147,6 @@ height: 150px; } -/* while other items look great, the term-operators text was getting cut off - * so we need to adjust the label width and height for the term operators - */ -#drupal-off-canvas .grouped-items .fieldset--group .fieldset__wrapper--group .glb-form-type--radio input.term-operator-item + label { - width: 130px !important; - height: 150px !important; -} - /* second column */ #drupal-off-canvas .grouped-items .fieldset--group.views-basic--view-mode .fieldset__wrapper--group .glb-form-type--radio label { width: 175px; @@ -321,3 +313,33 @@ background-position: center 1rem; background-size: 120%; } + +/* +/***** Event time period: +*/ +/* this is temporary until we have icons */ + +[data-drupal-selector="edit-settings-block-form-group-user-selection-entity-specific"] .fieldset__wrapper.fieldset__wrapper--group { + display: flex; +} + +[data-drupal-selector="edit-settings-block-form-group-user-selection-entity-specific"] .glb-form-radios.form-boolean-group { + display: flex; + width: 100%; + flex-direction: row; + gap: 1rem; +} + +[data-drupal-selector="edit-settings-block-form-group-user-selection-entity-specific"] .glb-form-type--radio label { + aspect-ratio: unset; + min-height: 4rem; +} + +.form-item-settings-block-form-group-user-selection-entity-specific-event-time-period + label { + background-color: var(--wool); +} + +.form-item-settings-block-form-group-user-selection-entity-specific-event-time-period input[checked="checked"] + label { + background-color: var(--color-text-primary); + color: var(--color-background-primary); +} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js index 3089e277fc..548161a294 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js @@ -1,36 +1,37 @@ ((Drupal) => { Drupal.behaviors.ysViewsBasic = { - attach: function() { // eslint-disable-line - // Function to handle radio input checked behavior based on radio element selection. + attach: function () { // eslint-disable-line + // Function to handle radio input checked behavior based on radio element selection. function handleRadioInputs(radioGroup) { // Get references to the radio input elements within the specified group const radioInputs = document.querySelectorAll(radioGroup); - + // Add event listener to each radio input - radioInputs.forEach((input) => { - input.addEventListener("change", function () { + radioInputs.forEach(input => { + input.addEventListener('change', function() { if (this.checked) { - this.setAttribute("checked", "checked"); + this.setAttribute('checked', 'checked'); // Remove the 'checked' attribute from other radio inputs - radioInputs.forEach((otherInput) => { + radioInputs.forEach(otherInput => { if (otherInput !== this) { - otherInput.removeAttribute("checked"); + otherInput.removeAttribute('checked'); } }); } }); }); } - + // Store radio input groups in an array - const radioGroups = [ + const radioGroups = [ 'input[name="settings[block_form][group_user_selection][entity_and_view_mode][entity_types]"]', 'input[name="settings[block_form][group_user_selection][entity_and_view_mode][view_mode]"]', - 'input[name="settings[block_form][group_user_selection][filter_and_sort][term_operator]"]', + 'input[name="settings[block_form][group_user_selection][filter_options][term_operator]"', + 'input[name="settings[block_form][group_user_selection][entity_specific][event_time_period]"]' ]; - + // Apply the function to each radio input group - radioGroups.forEach((group) => { + radioGroups.forEach(group => { handleRadioInputs(group); }); }, From beffbd4b1ccf0788aa6130d2fb4ec5b185a0ada6 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Tue, 29 Aug 2023 15:22:24 -0500 Subject: [PATCH 48/88] fix(yalb-1312): update views-basic with more radio elements for checked state visual feedback, add temporary styles for event period --- .../modules/custom/ys_views_basic/assets/js/views-basic.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js index 548161a294..cd4229df2b 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/js/views-basic.js @@ -27,6 +27,7 @@ 'input[name="settings[block_form][group_user_selection][entity_and_view_mode][entity_types]"]', 'input[name="settings[block_form][group_user_selection][entity_and_view_mode][view_mode]"]', 'input[name="settings[block_form][group_user_selection][filter_options][term_operator]"', + 'input[name="settings[block_form][group_user_selection][filter_and_sort][term_operator]"', 'input[name="settings[block_form][group_user_selection][entity_specific][event_time_period]"]' ]; From e827fdcf9aae89961585b7488d9a5aa2e357f8c9 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Tue, 29 Aug 2023 15:46:33 -0500 Subject: [PATCH 49/88] fix(yalb-1215): add config for new field_heading_level --- ...splay.block_content.cta_banner.default.yml | 7 +++++ ...splay.block_content.grand_hero.default.yml | 7 +++++ ...splay.block_content.cta_banner.default.yml | 8 ++++++ ...splay.block_content.grand_hero.default.yml | 8 ++++++ ...content.cta_banner.field_heading_level.yml | 23 ++++++++++++++++ ...content.grand_hero.field_heading_level.yml | 23 ++++++++++++++++ ...rage.block_content.field_heading_level.yml | 27 +++++++++++++++++++ 7 files changed, 103 insertions(+) create mode 100644 web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.cta_banner.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.cta_banner.default.yml index 357206e57b..8956dbd94a 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.cta_banner.default.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.cta_banner.default.yml @@ -5,6 +5,7 @@ dependencies: config: - block_content.type.cta_banner - field.field.block_content.cta_banner.field_heading + - field.field.block_content.cta_banner.field_heading_level - field.field.block_content.cta_banner.field_instructions - field.field.block_content.cta_banner.field_link - field.field.block_content.cta_banner.field_media @@ -39,6 +40,12 @@ content: maxlength_js: 50 maxlength_js_label: 'Content limited to @limit characters, remaining: @remaining' maxlength_js_enforce: false + field_heading_level: + type: options_select + weight: 16 + region: content + settings: { } + third_party_settings: { } field_instructions: type: markup weight: 0 diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.grand_hero.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.grand_hero.default.yml index e8ebeec9a3..ce2a8e3d16 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.grand_hero.default.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.block_content.grand_hero.default.yml @@ -5,6 +5,7 @@ dependencies: config: - block_content.type.grand_hero - field.field.block_content.grand_hero.field_heading + - field.field.block_content.grand_hero.field_heading_level - field.field.block_content.grand_hero.field_instructions - field.field.block_content.grand_hero.field_link - field.field.block_content.grand_hero.field_media @@ -39,6 +40,12 @@ content: maxlength_js: 50 maxlength_js_label: 'Content limited to @limit characters, remaining: @remaining' maxlength_js_enforce: false + field_heading_level: + type: options_select + weight: 10 + region: content + settings: { } + third_party_settings: { } field_instructions: type: markup weight: 0 diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.cta_banner.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.cta_banner.default.yml index 5958d59316..7fb869430f 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.cta_banner.default.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.cta_banner.default.yml @@ -5,6 +5,7 @@ dependencies: config: - block_content.type.cta_banner - field.field.block_content.cta_banner.field_heading + - field.field.block_content.cta_banner.field_heading_level - field.field.block_content.cta_banner.field_instructions - field.field.block_content.cta_banner.field_link - field.field.block_content.cta_banner.field_media @@ -27,6 +28,13 @@ content: third_party_settings: { } weight: 1 region: content + field_heading_level: + type: list_key + label: hidden + settings: { } + third_party_settings: { } + weight: 6 + region: content field_link: type: link_separate label: hidden diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.grand_hero.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.grand_hero.default.yml index e67117b3fa..fed2818560 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.grand_hero.default.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.block_content.grand_hero.default.yml @@ -5,6 +5,7 @@ dependencies: config: - block_content.type.grand_hero - field.field.block_content.grand_hero.field_heading + - field.field.block_content.grand_hero.field_heading_level - field.field.block_content.grand_hero.field_instructions - field.field.block_content.grand_hero.field_link - field.field.block_content.grand_hero.field_media @@ -27,6 +28,13 @@ content: third_party_settings: { } weight: 1 region: content + field_heading_level: + type: list_key + label: hidden + settings: { } + third_party_settings: { } + weight: 6 + region: content field_link: type: link_separate label: hidden diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml new file mode 100644 index 0000000000..009478cb93 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml @@ -0,0 +1,23 @@ +uuid: c4cb4f27-4116-41c1-bf7e-3be014652c3a +langcode: en +status: true +dependencies: + config: + - block_content.type.cta_banner + - field.storage.block_content.field_heading_level + module: + - options +id: block_content.cta_banner.field_heading_level +field_name: field_heading_level +entity_type: block_content +bundle: cta_banner +label: 'Heading Level' +description: 'Optionally override heading level for this banner' +required: false +translatable: false +default_value: + - + value: '2' +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml new file mode 100644 index 0000000000..346db4171a --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml @@ -0,0 +1,23 @@ +uuid: 7b19e30a-e34c-4869-8522-0ec9074beca3 +langcode: en +status: true +dependencies: + config: + - block_content.type.grand_hero + - field.storage.block_content.field_heading_level + module: + - options +id: block_content.grand_hero.field_heading_level +field_name: field_heading_level +entity_type: block_content +bundle: grand_hero +label: 'Heading Level' +description: 'Optionally override heading level for this banner' +required: false +translatable: true +default_value: + - + value: '2' +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml new file mode 100644 index 0000000000..fee4557001 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml @@ -0,0 +1,27 @@ +uuid: 55bae3c6-a2a3-4e10-85ac-63cc9eefc787 +langcode: en +status: true +dependencies: + module: + - block_content + - options +id: block_content.field_heading_level +field_name: field_heading_level +entity_type: block_content +type: list_string +settings: + allowed_values: + - + value: '1' + label: H1 + - + value: '2' + label: H2 + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false From 1753ebcad8159ddd7bbb42be317ad7e1864ff462 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 29 Aug 2023 13:48:47 -0700 Subject: [PATCH 50/88] feat(YALB-1485): Conditionally show/hide field groups for basic/mega footer --- .../ys_core/src/Form/FooterSettingsForm.php | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 7af57fb748..518a157fad 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -64,50 +64,60 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['#attached']['library'][] = 'ys_core/footer_settings_form'; - $form['footer_tabs'] = [ - '#type' => 'vertical_tabs', + $form['footer_variation'] = [ + '#type' => 'radios', + '#options' => [ + 'basic' => $this->t('Basic'), + 'mega' => $this->t('Mega'), + ], + '#title' => $this->t('Footer variation'), + '#description' => $this->t('All variations display Yale branding, accessibility and privacy links, and copyright information.'), + '#default_value' => ($footerConfig->get('footer_variation')) ? $footerConfig->get('footer_variation') : 'basic', ]; $form['footer_logos'] = [ '#type' => 'details', '#title' => $this->t('Footer Logos'), - '#open' => TRUE, - '#group' => 'footer_tabs', + '#states' => [ + 'visible' => [ + ':input[name="footer_variation"]' => ['value' => 'mega'], + ], + ], ]; $form['footer_content'] = [ '#type' => 'details', '#title' => $this->t('Footer Content'), - '#group' => 'footer_tabs', + '#states' => [ + 'visible' => [ + ':input[name="footer_variation"]' => ['value' => 'mega'], + ], + ], ]; $form['footer_links'] = [ '#type' => 'details', '#title' => $this->t('Footer Links'), - '#group' => 'footer_tabs', '#attributes' => [ 'class' => [ 'ys-footer-links', ], ], + '#states' => [ + 'visible' => [ + ':input[name="footer_variation"]' => ['value' => 'mega'], + ], + ], ]; $form['social_links'] = [ '#type' => 'details', '#title' => $this->t('Social Links'), - '#group' => 'footer_tabs', - ]; - - $form['footer_variation'] = [ - '#type' => 'radios', - '#options' => [ - 'basic' => $this->t('Basic - displays only the social links.'), - 'mega' => $this->t('Mega - displays all of the fields listed below.'), + '#states' => [ + 'open' => [ + ':input[name="footer_variation"]' => ['value' => 'basic'], + ], ], - '#title' => $this->t('Footer variation'), - '#description' => $this->t('All variations display Yale branding, accessibility and privacy links, and copyright information.'), - '#default_value' => ($footerConfig->get('footer_variation')) ? $footerConfig->get('footer_variation') : 'basic', - '#weight' => -1, ]; $form['footer_logos']['logos'] = [ @@ -382,7 +392,7 @@ protected function validateFooterLinks($form_state, $field_id) { */ protected function translateNodeLinks($link) { // If link URL is an internal path, use the path alias instead. - $link = (str_starts_with($link, "/node")) ? $this->pathAliasManager->getAliasByPath($link) : $link; + $link = (str_starts_with($link, "/node/")) ? $this->pathAliasManager->getAliasByPath($link) : $link; return $link; } From 2e887e96b3145143d7281961c15818c7082f8582 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 29 Aug 2023 14:54:57 -0700 Subject: [PATCH 51/88] feat(YALB-1510): Change title and help text for "description" for use with menu heading CTA --- .../modules/custom/ys_core/ys_core.module | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index 7a91339df4..15976a683b 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -103,11 +103,34 @@ function ys_core_form_alter(&$form, $form_state, $form_id) { ]; } - // Alter description/placeholder to be used for new first level heading link. + // Alter description/placeholder for new first level heading link. + $topLevelTitle = "Top level main menu link CTA"; + $topLevelDesc = "Top level links in the main menu will use this as the call to action text on the right side of the mega menu."; + $topLevelPlaceholder = "Explore all"; + $replacements = [ + '@title' => $topLevelTitle, + '@desc' => $topLevelDesc, + '@placeholder' => $topLevelPlaceholder, + ]; + if ($form_id == 'menu_link_content_menu_link_content_form') { - $form['description']['widget'][0]['value']['#description'] = t('Top level main menu links will use this as the CTA text on the left side.'); - $form['description']['widget'][0]['value']['#placeholder'] = t('Explore all'); + $form['description']['widget'][0]['value']['#title'] = t('@title', $replacements); + $form['description']['widget'][0]['value']['#description'] = t('@desc', $replacements); + $form['description']['widget'][0]['value']['#placeholder'] = t('@placeholder', $replacements); } + + $alterDescriptionNodeForms = [ + 'node_page_edit_form', + 'node_page_add_form', + ]; + + if (in_array($form_id, $alterDescriptionNodeForms)) { + $form['menu']['link']['description']['#title'] = t('@title', $replacements); + $form['menu']['link']['description']['#description'] = t('@desc', $replacements); + $form['menu']['link']['description']['#placeholder'] = t('@placeholder', $replacements); + } + // End alter description/placeholder for first level heading link. + } /** From c0c13f9c592cb3ea7890da40a58d82646b83fbc5 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 29 Aug 2023 15:15:10 -0700 Subject: [PATCH 52/88] fix(YALB-1510): Fix linting error --- .../yalesites_profile/modules/custom/ys_core/ys_core.module | 1 - 1 file changed, 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index 15976a683b..daa2e74fa1 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -130,7 +130,6 @@ function ys_core_form_alter(&$form, $form_state, $form_id) { $form['menu']['link']['description']['#placeholder'] = t('@placeholder', $replacements); } // End alter description/placeholder for first level heading link. - } /** From d7466d840e7249c5900ef357c8578d1e88cbdf3e Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Tue, 29 Aug 2023 16:45:51 -0700 Subject: [PATCH 53/88] chore(YALB-1510): Disable adding profiles to menus to match events and posts --- .../yalesites_profile/config/sync/captcha.settings.yml | 6 +++--- .../yalesites_profile/config/sync/node.type.profile.yml | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml b/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml index de16739de7..1a9aa1b1f0 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml @@ -1,14 +1,14 @@ _core: default_config_hash: hSAUW7BoAd9YUpKcVKyZpW4wY67g4XZAYlt3Vnz6SVA +enabled_default: 0 default_challenge: recaptcha_v3/form_submission description: 'This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.' administration_mode: false +allow_on_admin_pages: false whitelist_ips: '' +add_captcha_description: true wrong_captcha_response_message: 'The answer you entered for the CAPTCHA was not correct.' default_validation: 1 persistence: 1 enable_stats: false log_wrong_responses: false -enabled_default: 0 -allow_on_admin_pages: false -add_captcha_description: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/node.type.profile.yml b/web/profiles/custom/yalesites_profile/config/sync/node.type.profile.yml index 836f9639da..466189c2c5 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/node.type.profile.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/node.type.profile.yml @@ -31,9 +31,8 @@ third_party_settings: url: '' external: '' menu_ui: - available_menus: - - main - parent: 'main:' + available_menus: { } + parent: '' search_api_exclude: enabled: 1 node_revision_delete: From f3da7177304c205da26c7b24cec7d73e948b3cd8 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 30 Aug 2023 15:28:30 -0500 Subject: [PATCH 54/88] fix(yalb-1215): update field_heading_level to use allowed values instead of Drupal config --- ...ld.block_content.cta_banner.field_heading_level.yml | 6 ++---- ...ld.block_content.grand_hero.field_heading_level.yml | 6 ++---- ...field.storage.block_content.field_heading_level.yml | 10 ++-------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml index 009478cb93..1cf9da8842 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml @@ -15,9 +15,7 @@ label: 'Heading Level' description: 'Optionally override heading level for this banner' required: false translatable: false -default_value: - - - value: '2' -default_value_callback: '' +default_value: { } +default_value_callback: ys_themes_default_value_function settings: { } field_type: list_string diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml index 346db4171a..3b34d79582 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml @@ -15,9 +15,7 @@ label: 'Heading Level' description: 'Optionally override heading level for this banner' required: false translatable: true -default_value: - - - value: '2' -default_value_callback: '' +default_value: { } +default_value_callback: ys_themes_default_value_function settings: { } field_type: list_string diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml index fee4557001..15df9658e9 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml @@ -10,14 +10,8 @@ field_name: field_heading_level entity_type: block_content type: list_string settings: - allowed_values: - - - value: '1' - label: H1 - - - value: '2' - label: H2 - allowed_values_function: '' + allowed_values: { } + allowed_values_function: ys_themes_allowed_values_function module: options locked: false cardinality: 1 From 682922c0f3aa05a77b1192b3e9aae41f60bb55ee Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 30 Aug 2023 15:28:48 -0500 Subject: [PATCH 55/88] fix(yalb-1215): update field_heading_level to use allowed values instead of Drupal config --- .../config/install/ys_themes.component_overrides.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml index 9c7a9f89b9..feea03f8e2 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml @@ -18,6 +18,11 @@ cta_banner: left: Left right: Right default: bottom + field_heading_level: + values: + 1: h1 + 2: h2 + default: 2 pull_quote: field_style_variation: values: @@ -93,6 +98,11 @@ grand_hero: full: Tall reduced: Short default: full + field_heading_level: + values: + 1: h1 + 2: h2 + default: 2 divider: field_style_position: values: From cf4ee4d2278b2a3d94e20c9576f5b8b55490c066 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 30 Aug 2023 15:29:28 -0500 Subject: [PATCH 56/88] fix(yalb-1312): update radios to use grouped items so they are hidden --- .../ys_views_basic/assets/css/views-basic.css | 30 ------------------- .../FieldWidget/ViewsBasicDefaultWidget.php | 5 ++++ 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css index a1cd61e146..46029f4926 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css @@ -313,33 +313,3 @@ background-position: center 1rem; background-size: 120%; } - -/* -/***** Event time period: -*/ -/* this is temporary until we have icons */ - -[data-drupal-selector="edit-settings-block-form-group-user-selection-entity-specific"] .fieldset__wrapper.fieldset__wrapper--group { - display: flex; -} - -[data-drupal-selector="edit-settings-block-form-group-user-selection-entity-specific"] .glb-form-radios.form-boolean-group { - display: flex; - width: 100%; - flex-direction: row; - gap: 1rem; -} - -[data-drupal-selector="edit-settings-block-form-group-user-selection-entity-specific"] .glb-form-type--radio label { - aspect-ratio: unset; - min-height: 4rem; -} - -.form-item-settings-block-form-group-user-selection-entity-specific-event-time-period + label { - background-color: var(--wool); -} - -.form-item-settings-block-form-group-user-selection-entity-specific-event-time-period input[checked="checked"] + label { - background-color: var(--color-text-primary); - color: var(--color-background-primary); -} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php index 4f35d46c8a..f5a404f7fc 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php @@ -159,6 +159,11 @@ public function formElement( $form['group_user_selection']['entity_specific'] = [ '#type' => 'container', + '#attributes' => [ + 'class' => [ + 'grouped-items', + ], + ], ]; $form['group_user_selection']['options'] = [ From 053e94ea28fd4ebbcf0f05bd7567a155eafed8c4 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 30 Aug 2023 16:10:42 -0500 Subject: [PATCH 57/88] fix(yalb-1312): revert field_heading_level using our component_overrides --- ...ld.block_content.cta_banner.field_heading_level.yml | 6 ++++-- ...ld.block_content.grand_hero.field_heading_level.yml | 6 ++++-- ...field.storage.block_content.field_heading_level.yml | 10 ++++++++-- .../config/install/ys_themes.component_overrides.yml | 10 ---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml index 1cf9da8842..009478cb93 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml @@ -15,7 +15,9 @@ label: 'Heading Level' description: 'Optionally override heading level for this banner' required: false translatable: false -default_value: { } -default_value_callback: ys_themes_default_value_function +default_value: + - + value: '2' +default_value_callback: '' settings: { } field_type: list_string diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml index 3b34d79582..346db4171a 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml @@ -15,7 +15,9 @@ label: 'Heading Level' description: 'Optionally override heading level for this banner' required: false translatable: true -default_value: { } -default_value_callback: ys_themes_default_value_function +default_value: + - + value: '2' +default_value_callback: '' settings: { } field_type: list_string diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml index 15df9658e9..fee4557001 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.storage.block_content.field_heading_level.yml @@ -10,8 +10,14 @@ field_name: field_heading_level entity_type: block_content type: list_string settings: - allowed_values: { } - allowed_values_function: ys_themes_allowed_values_function + allowed_values: + - + value: '1' + label: H1 + - + value: '2' + label: H2 + allowed_values_function: '' module: options locked: false cardinality: 1 diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml index feea03f8e2..9c7a9f89b9 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_themes/config/install/ys_themes.component_overrides.yml @@ -18,11 +18,6 @@ cta_banner: left: Left right: Right default: bottom - field_heading_level: - values: - 1: h1 - 2: h2 - default: 2 pull_quote: field_style_variation: values: @@ -98,11 +93,6 @@ grand_hero: full: Tall reduced: Short default: full - field_heading_level: - values: - 1: h1 - 2: h2 - default: 2 divider: field_style_position: values: From ee6ac8b377eff40c76987f6ad710806867efb7ae Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Wed, 30 Aug 2023 17:14:26 -0500 Subject: [PATCH 58/88] fix(yalb-mega-footer): breaking each footer type into its own partial --- .../templates/ys-footer-block.html.twig | 123 +++++++++--------- 1 file changed, 64 insertions(+), 59 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig index 7eb4a6adea..99ee8d8e2f 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/templates/ys-footer-block.html.twig @@ -2,74 +2,79 @@ {% set link_group__base_class = 'link-group' %} {% set school_logo_url = school_logo_url|default('/') %} -{#TODO: set site_footer__variation to getThemeSetting('footer_variation')#} {% embed "@organisms/site-footer/yds-site-footer.twig" with { site_footer__border_thickness: '8', site_footer__theme: getThemeSetting('footer_theme'), site_footer__variation: footer_variation|default('basic'), }%} - {% if site_footer__variation == 'mega'%} - {% block site_footer__logos %} - {% for logo in footer_logos %} - {% if logo.url %} - - {% endif %} - {{ logo.logo }} - {% if logo.url %} - - {% endif %} - {% endfor %} - {% endblock %} + {% block footer__inner %} + {% if site_footer__variation == 'mega'%} + {% embed "@organisms/site-footer/_site-footer-mega.twig" %} + {% block site_footer__logos %} + {% for logo in footer_logos %} + {% if logo.url %} + + {% endif %} + {{ logo.logo }} + {% if logo.url %} + + {% endif %} + {% endfor %} + {% endblock %} - {% block site_footer__yale_logo %} - {% if school_logo %} - - {{ school_logo }} - - {% endif %} - {% endblock %} + {% block site_footer__yale_logo %} + {% if school_logo %} + + {{ school_logo }} + + {% endif %} + {% endblock %} - {% block site_footer__content %} - {{ footer_text }} - {% endblock %} + {% block site_footer__content %} + {{ footer_text }} + {% endblock %} - {% block site_footer__two_columns %} - {% embed "@molecules/link-group/yds-link-group.twig" with { - link_group__heading_one: footer_links_col_1_heading, - link_group__heading_two: footer_links_col_2_heading, - } %} - {% block link_group__links %} - {% if footer_links_col_1 %} -
    - {% for link in footer_links_col_1 %} - {% include "@molecules/link-group/_yds-link-group--links.twig" with { - link_group__link__url: link.link_url, - link_group__link__content: link.link_title, - }%} - {% endfor %} -
- {% endif %} - {% if footer_links_col_2 %} -
    - {% for link in footer_links_col_2 %} - {% include "@molecules/link-group/_yds-link-group--links.twig" with { - link_group__link__url: link.link_url, - link_group__link__content: link.link_title, - }%} - {% endfor %} -
- {% endif %} + {% block site_footer__two_columns %} + {% embed "@molecules/link-group/yds-link-group.twig" with { + link_group__heading_one: footer_links_col_1_heading, + link_group__heading_two: footer_links_col_2_heading, + } %} + {% block link_group__links %} + {% if footer_links_col_1 %} +
    + {% for link in footer_links_col_1 %} + {% include "@molecules/link-group/_yds-link-group--links.twig" with { + link_group__link__url: link.link_url, + link_group__link__content: link.link_title, + }%} + {% endfor %} +
+ {% endif %} + {% if footer_links_col_2 %} +
    + {% for link in footer_links_col_2 %} + {% include "@molecules/link-group/_yds-link-group--links.twig" with { + link_group__link__url: link.link_url, + link_group__link__content: link.link_title, + }%} + {% endfor %} +
+ {% endif %} + {% endblock %} + {% endembed %} + {{ drupal_block('social_links_block') }} + {% endblock %} + {% endembed %} + {% else %} + {# basic footer #} + {% embed "@organisms/site-footer/_site-footer-basic.twig" %} + {% block site_footer__text %}{% endblock %} + {% block site_footer__columns %}{% endblock %} + {% block site_footer__social %} + {{ drupal_block('social_links_block') }} {% endblock %} {% endembed %} - {{ drupal_block('social_links_block') }} - {% endblock %} - {% else %} - {# basic footer #} - {% block site_footer__text %}{% endblock %} - {% block site_footer__columns %}{% endblock %} - {% block site_footer__social %} - {{ drupal_block('social_links_block') }} - {% endblock %} - {% endif %} + {% endif %} + {% endblock %} {% endembed %} From a1f9a906c7782e3569994fbd78348088477711ca Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Wed, 30 Aug 2023 15:17:57 -0700 Subject: [PATCH 59/88] refactor(YALB-1510): Switch from core menu item description field to menu item extras field --- .../custom/yalesites_profile/composer.json | 1 + ...display.menu_link_content.main.default.yml | 56 +++++++++++++++ ...display.menu_link_content.main.default.yml | 27 ++++++++ .../config/sync/core.extension.yml | 1 + ...ent.main.field_menu_top_level_link_cta.yml | 19 +++++ ..._content.field_menu_top_level_link_cta.yml | 21 ++++++ .../config/sync/menu_item_extras.utility.yml | 3 + .../config/sync/ys_admin_theme.settings.yml | 2 +- .../modules/custom/ys_core/ys_core.module | 69 ++++++------------- 9 files changed, 151 insertions(+), 48 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.menu_link_content.main.default.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.menu_link_content.main.default.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/field.field.menu_link_content.main.field_menu_top_level_link_cta.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/field.storage.menu_link_content.field_menu_top_level_link_cta.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/menu_item_extras.utility.yml diff --git a/web/profiles/custom/yalesites_profile/composer.json b/web/profiles/custom/yalesites_profile/composer.json index 47de6c0584..8395fce695 100644 --- a/web/profiles/custom/yalesites_profile/composer.json +++ b/web/profiles/custom/yalesites_profile/composer.json @@ -58,6 +58,7 @@ "drupal/media_library_form_element": "^2.0", "drupal/menu_admin_per_menu": "^1.4", "drupal/menu_breadcrumb": "^1.16", + "drupal/menu_item_extras": "^3.0", "drupal/metatag": "^1.19", "drupal/migrate_plus": "^6.0", "drupal/migrate_tools": "^6.0", diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.menu_link_content.main.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.menu_link_content.main.default.yml new file mode 100644 index 0000000000..c70bcbe082 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_form_display.menu_link_content.main.default.yml @@ -0,0 +1,56 @@ +uuid: 7163bb95-00d9-47d6-878c-6dafc58f6e69 +langcode: en +status: true +dependencies: + config: + - field.field.menu_link_content.main.field_menu_top_level_link_cta + - system.menu.main + module: + - hide_revision_field + - link + - menu_item_extras +id: menu_link_content.main.default +targetEntityType: menu_link_content +bundle: main +mode: default +content: + field_menu_top_level_link_cta: + type: string_textfield + weight: 1 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + revision_log_message: + type: hide_revision_field_log_widget + weight: 4 + region: content + settings: + rows: 5 + placeholder: '' + show: true + default: '' + permission_based: false + allow_user_settings: true + third_party_settings: { } + simple_sitemap: + weight: 3 + region: content + settings: { } + third_party_settings: { } + title: + type: string_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + view_mode: + type: menu_item_extras_view_mode_selector_select + weight: 2 + region: content + settings: { } + third_party_settings: { } +hidden: { } diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.menu_link_content.main.default.yml b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.menu_link_content.main.default.yml new file mode 100644 index 0000000000..62f5a5d0d8 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/core.entity_view_display.menu_link_content.main.default.yml @@ -0,0 +1,27 @@ +uuid: d53fde33-1a5a-43ac-b379-bc535ea439b9 +langcode: en +status: true +dependencies: + config: + - field.field.menu_link_content.main.field_menu_top_level_link_cta + - system.menu.main +id: menu_link_content.main.default +targetEntityType: menu_link_content +bundle: main +mode: default +content: + children: + settings: { } + third_party_settings: { } + weight: 1 + region: content + field_menu_top_level_link_cta: + type: string + label: above + settings: + link_to_entity: false + third_party_settings: { } + weight: 2 + region: content +hidden: + search_api_excerpt: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml b/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml index 0c64cc529a..3ea7268726 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml @@ -74,6 +74,7 @@ module: media_library_edit: 0 media_library_form_element: 0 menu_breadcrumb: 0 + menu_item_extras: 0 menu_link_content: 0 menu_ui: 0 metatag: 0 diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.menu_link_content.main.field_menu_top_level_link_cta.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.menu_link_content.main.field_menu_top_level_link_cta.yml new file mode 100644 index 0000000000..c30ae0a9a4 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.menu_link_content.main.field_menu_top_level_link_cta.yml @@ -0,0 +1,19 @@ +uuid: 205ea9ae-7443-403d-9ce5-5546690cbbf8 +langcode: en +status: true +dependencies: + config: + - field.storage.menu_link_content.field_menu_top_level_link_cta + - system.menu.main +id: menu_link_content.main.field_menu_top_level_link_cta +field_name: field_menu_top_level_link_cta +entity_type: menu_link_content +bundle: main +label: 'Mega Menu Top Level Link Text' +description: 'Mega Menu level one links display this link text alongside the Menu link title. If empty, defaults to "Explore all".' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.storage.menu_link_content.field_menu_top_level_link_cta.yml b/web/profiles/custom/yalesites_profile/config/sync/field.storage.menu_link_content.field_menu_top_level_link_cta.yml new file mode 100644 index 0000000000..411d56f8bd --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/field.storage.menu_link_content.field_menu_top_level_link_cta.yml @@ -0,0 +1,21 @@ +uuid: b187d15b-8ade-407c-8611-80cbb81b3aa8 +langcode: en +status: true +dependencies: + module: + - menu_link_content +id: menu_link_content.field_menu_top_level_link_cta +field_name: field_menu_top_level_link_cta +entity_type: menu_link_content +type: string +settings: + max_length: 255 + case_sensitive: false + is_ascii: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/web/profiles/custom/yalesites_profile/config/sync/menu_item_extras.utility.yml b/web/profiles/custom/yalesites_profile/config/sync/menu_item_extras.utility.yml new file mode 100644 index 0000000000..b3b434d128 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/config/sync/menu_item_extras.utility.yml @@ -0,0 +1,3 @@ +_core: + default_config_hash: eJyVsRDycEefcdJUBrw82evYJtCphyLU4BV5MMQ5rPQ +entity_type_build_status: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/ys_admin_theme.settings.yml b/web/profiles/custom/yalesites_profile/config/sync/ys_admin_theme.settings.yml index 271443e831..142e8584ad 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/ys_admin_theme.settings.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/ys_admin_theme.settings.yml @@ -7,7 +7,7 @@ logo: use_default: 1 favicon: use_default: 1 -enable_darkmode: '0' +enable_darkmode: '1' preset_accent_color: light_blue accent_color: '' preset_focus_color: dark diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index daa2e74fa1..087aaad0fd 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -102,34 +102,6 @@ function ys_core_form_alter(&$form, $form_state, $form_id) { '#markup' => "

" . t('@description', $replacements) . "

", ]; } - - // Alter description/placeholder for new first level heading link. - $topLevelTitle = "Top level main menu link CTA"; - $topLevelDesc = "Top level links in the main menu will use this as the call to action text on the right side of the mega menu."; - $topLevelPlaceholder = "Explore all"; - $replacements = [ - '@title' => $topLevelTitle, - '@desc' => $topLevelDesc, - '@placeholder' => $topLevelPlaceholder, - ]; - - if ($form_id == 'menu_link_content_menu_link_content_form') { - $form['description']['widget'][0]['value']['#title'] = t('@title', $replacements); - $form['description']['widget'][0]['value']['#description'] = t('@desc', $replacements); - $form['description']['widget'][0]['value']['#placeholder'] = t('@placeholder', $replacements); - } - - $alterDescriptionNodeForms = [ - 'node_page_edit_form', - 'node_page_add_form', - ]; - - if (in_array($form_id, $alterDescriptionNodeForms)) { - $form['menu']['link']['description']['#title'] = t('@title', $replacements); - $form['menu']['link']['description']['#description'] = t('@desc', $replacements); - $form['menu']['link']['description']['#placeholder'] = t('@placeholder', $replacements); - } - // End alter description/placeholder for first level heading link. } /** @@ -172,33 +144,36 @@ function ys_core_user_login_form_submit($form, FormStateInterface $form_state) { } /** - * Implements hook_page_preprocess_menu__main(). + * Implements theme_preprocess_menu(). */ -function ys_core_preprocess_menu__main(&$variables) { - // If submenu, add the top level link as the first link in the submenu. - foreach ($variables['items'] as &$menuItem) { - // Skip menu items that do not have subitems. - if (empty($menuItem['below'])) { - continue; - } +function ys_core_preprocess_menu(&$variables) { + if ($variables['menu_name'] == 'main') { + // If submenu, add the top level link as the first link in the submenu. + foreach ($variables['items'] as &$menuItem) { + // Skip menu items that do not have subitems. + if (empty($menuItem['below'])) { + continue; + } - // Clone top level menu item. - $clonedMenuItem = $menuItem; + // Clone top level menu item. + $clonedMenuItem = $menuItem; - // We don't want any other subitems, just the top level. - $clonedMenuItem['below'] = NULL; + // We don't want any other subitems, just the top level. + $clonedMenuItem['below'] = NULL; - // Main menu items get the heading treatment. - // @see component-library-twig/components/02-molecules/menu/_yds-menu-item.twig - $clonedMenuItem['is_heading'] = TRUE; + // Main menu items get the heading treatment. + // @see component-library-twig/components/02-molecules/menu/_yds-menu-item.twig + $clonedMenuItem['list__item__is_heading'] = TRUE; - // Get the description in the menu item to use as the CTA. - $clonedMenuItem['heading_cta'] = ($clonedMenuItem['original_link']->getDescription()) ?? t('Explore all'); + // Get the CTA text from menu item extras field. + $clonedMenuItem['heading_cta'] = $clonedMenuItem['entity']->get('field_menu_top_level_link_cta')->value ?: t('Explore all'); - // Add cloned item to the beginning of the menu. - array_unshift($menuItem['below'], $clonedMenuItem); + // Add cloned item to the beginning of the menu. + array_unshift($menuItem['below'], $clonedMenuItem); + } } + } /** From cb9c408141770caa34cbe66d8547f8aca1fd56d6 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Wed, 30 Aug 2023 15:54:46 -0700 Subject: [PATCH 60/88] feat(YALB-1510): Add menu item extras to page add/edit forms --- .../modules/custom/ys_core/ys_core.module | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module index 087aaad0fd..1ccdbae8d4 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.module @@ -6,10 +6,12 @@ */ use Drupal\Core\Cache\Cache; +use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; +use Drupal\menu_item_extras\Entity\MenuItemExtrasMenuLinkContent; /** * @file @@ -315,3 +317,91 @@ function ys_core_preprocess_image_widget(&$variables) { function ys_core_taxonomy_term_update() { Cache::invalidateTags(['rendered']); } + +/** + * The following functions add menu item extras fields to node add/edit forms. + * + * @see https://www.drupal.org/project/menu_item_extras/issues/2992096#comment-14140361 + */ + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function ys_core_form_node_page_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) { + ys_core_page_form_alter($form, $form_state); +} + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function ys_core_form_node_page_form_alter(&$form, FormStateInterface $form_state, $form_id) { + ys_core_page_form_alter($form, $form_state); +} + +/** + * THe Drupal backend cache renderer service. + * + * @var array $form + * The form array. + * @var Drupal\Core\Form\FormStateInterface $form_state + * The current form state. + */ +function ys_core_page_form_alter(&$form, FormStateInterface $form_state) { + + // Add menu link fields to node form. + if ($link = _ys_core_get_link($form_state)) { + $form_display = EntityFormDisplay::load('menu_link_content.' . $link->getMenuName() . '.default'); + assert($form_display instanceof EntityFormDisplay); + $form['menu']['link']['extra'] = [ + '#type' => 'container', + '#parents' => ['menu', 'extra'], + ]; + $form_display->buildForm($link, $form['menu']['link']['extra'], $form_state); + // Only keep custom fields, other properties already are in the form. + foreach (Element::children($form['menu']['link']['extra']) as $key) { + if (strpos($key, 'field_') !== 0) { + unset($form['menu']['link']['extra'][$key]); + } + } + + foreach (array_keys($form['actions']) as $action) { + if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') { + $form['actions'][$action]['#submit'][] = 'ys_core_save_menu_link_fields'; + } + } + } +} + +/** + * Saves the menu item extras when on the node add/edit pages. + * + * @throws \Drupal\Core\Entity\EntityStorageException + */ +function ys_core_save_menu_link_fields(array $form, FormStateInterface $form_state) { + if ($link = _ys_core_get_link($form_state)) { + $form_display = EntityFormDisplay::load('menu_link_content.' . $link->getMenuName() . '.default'); + assert($form_display instanceof EntityFormDisplay); + $form_display->extractFormValues($link, $form['menu']['link']['extra'], $form_state); + $link->save(); + } +} + +/** + * Gets any menu item extras content. + * + * @return Drupal\menu_item_extras\Entity\MenuItemExtrasMenuLinkContent + * Menu item extras content. + */ +function _ys_core_get_link(FormStateInterface $form_state) { + /** @var Drupal\node\Entity $form_state */ + $node = $form_state->getFormObject()->getEntity(); + $defaults = menu_ui_get_menu_link_defaults($node); + if ($mlid = $defaults['entity_id']) { + return MenuItemExtrasMenuLinkContent::load($mlid); + } + return MenuItemExtrasMenuLinkContent::create($defaults); +} + +/** + * End allow menu item extras fields to be included on node add and edit forms. + */ From 80371d1c11ad3a0d88c93deba64589c6c1ce2821 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Wed, 30 Aug 2023 18:34:20 -0700 Subject: [PATCH 61/88] feat(YALB-1485): Update footer settings form with icons, dynamic enable/disable --- .../ys_core/css/footer-settings-form.css | 89 +++++++- .../ys_core/images/icons/disabled-details.svg | 204 ++++++++++++++++++ .../images/preview-icons/basic-footer.svg | 11 + .../images/preview-icons/mega-footer.svg | 30 +++ .../custom/ys_core/js/footer-settings.js | 34 +++ .../ys_core/src/Form/FooterSettingsForm.php | 63 ++++-- .../custom/ys_core/ys_core.libraries.yml | 2 + 7 files changed, 416 insertions(+), 17 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/icons/disabled-details.svg create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/basic-footer.svg create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/mega-footer.svg create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css index 0f8f2e8bfe..cd0011c62b 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css @@ -1,7 +1,94 @@ @media screen and (min-width: 1380px) { - .ys-footer-links .details-wrapper, .ys-footer-links .claro-details__content { + .ys-footer-links .details-wrapper, + .ys-footer-links .claro-details__content { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; } } + +.ys-core-footer-settings-form + .claro-details.form-disabled + .claro-details__summary { + background-color: #6f6f6f !important; +} + +.ys-core-footer-settings-form .claro-details.form-disabled { + pointer-events: none; + user-select: none; +} + +.ys-core-footer-settings-form + .claro-details.form-disabled + .claro-details__summary::after { + background-image: url("../images/icons/disabled-details.svg"); + background-repeat: no-repeat; + background-size: contain; + box-shadow: none; + content: ""; + display: inline-block; + height: 2rem; + left: 11rem; + opacity: 1; + position: absolute; + top: 50%; + transform: translateY(-50%); + width: 2rem; +} + +.footer-variation-radios .form-radios { + display: flex; +} + +.form-item--footer-variation.form-type--radio input { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +.form-item--footer-variation.form-type--radio label { + flex: 1 auto; + padding: var(--size-spacing-6) var(--size-spacing-4); + border-radius: 0.25rem; + border: 2px solid var(--color-border); + aspect-ratio: 2/1; + display: block !important; + text-align: left; + background: var(--dark-theme-gray); + border: 2px solid white; + padding: var(--size-spacing-4) var(--size-spacing-5); + color: var(--color-text-primary); + border-radius: 0.25rem; + margin-bottom: var(--size-spacing-4); + width: 178px; + height: 131px; +} + +.form-item--footer-variation input[value="basic"] + label { + background-image: url("../images/preview-icons/basic-footer.svg"); + background-repeat: no-repeat; + background-position: center -2px; + text-align: center; +} + +.form-item--footer-variation input[value="mega"] + label { + background-image: url("../images/preview-icons/mega-footer.svg"); + background-repeat: no-repeat; + background-position: center -2px; + text-align: center; +} + +.form-item--footer-variation input[checked="checked"] + label, +.form-item--footer-variation input[checked="checked"] + label:hover, +.form-item--footer-variation + .form-boolean--type-radio:hover + input[checked="checked"] + + label { + background-color: #3b3b3f; + color: var(--color-background-primary) !important; +} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/icons/disabled-details.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/icons/disabled-details.svg new file mode 100644 index 0000000000..e8b3accc58 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/icons/disabled-details.svg @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/basic-footer.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/basic-footer.svg new file mode 100644 index 0000000000..08557cbf6e --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/basic-footer.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/mega-footer.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/mega-footer.svg new file mode 100644 index 0000000000..4320100083 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/mega-footer.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js new file mode 100644 index 0000000000..727e16330e --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js @@ -0,0 +1,34 @@ +((Drupal) => { + Drupal.behaviors.ysCoreFooterSettings = { + attach: function() { // eslint-disable-line + // Function to handle radio input checked behavior based on radio element selection. + function handleRadioInputs(radioGroup) { + // Get references to the radio input elements within the specified group + const radioInputs = document.querySelectorAll(radioGroup); + + // Add event listener to each radio input + radioInputs.forEach((input) => { + input.addEventListener("change", function () { + if (this.checked) { + this.setAttribute("checked", "checked"); + // Remove the 'checked' attribute from other radio inputs + radioInputs.forEach((otherInput) => { + if (otherInput !== this) { + otherInput.removeAttribute("checked"); + } + }); + } + }); + }); + } + + // Store radio input groups in an array + const radioGroups = ['input[name="footer_variation"]']; + + // Apply the function to each radio input group + radioGroups.forEach((group) => { + handleRadioInputs(group); + }); + }, + }; +})(Drupal); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 518a157fad..ed951687d2 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -71,16 +71,57 @@ public function buildForm(array $form, FormStateInterface $form_state) { 'mega' => $this->t('Mega'), ], '#title' => $this->t('Footer variation'), - '#description' => $this->t('All variations display Yale branding, accessibility and privacy links, and copyright information.'), '#default_value' => ($footerConfig->get('footer_variation')) ? $footerConfig->get('footer_variation') : 'basic', + '#attributes' => [ + 'class' => [ + 'footer-variation-radios', + ], + ], + ]; + + $form['desc_basic_container'] = [ + '#type' => 'container', + '#title' => $this->t('Basic Footer'), + '#states' => [ + 'visible' => [ + ':input[name="footer_variation"]' => ['value' => 'basic'], + ], + ], + ]; + + $form['desc_mega_container'] = [ + '#type' => 'container', + '#title' => $this->t('Mega Footer'), + '#states' => [ + 'visible' => [ + ':input[name="footer_variation"]' => ['value' => 'mega'], + ], + ], + ]; + + $form['desc_basic_container']['desc_basic'] = [ + '#type' => 'markup', + '#prefix' => '

Basic Footer

', + '#markup' => $this->t('The basic footer of your website contains only social media icons and Yale branding.'), + ]; + + $form['desc_mega_container']['desc_mega'] = [ + '#type' => 'markup', + '#prefix' => '

Mega Footer

', + '#markup' => $this->t('The mega footer of your website can be customized to suit your organizational needs. You can upload icons for various organizational identities and other platforms that your organization uses. You can also add a customizable text area with general information, contact information, or a physical address. Additionally, you can add up to 8 links in a two-column format.'), + ]; + + $form['social_links'] = [ + '#type' => 'details', + '#title' => $this->t('Social Links'), ]; $form['footer_logos'] = [ '#type' => 'details', '#title' => $this->t('Footer Logos'), '#states' => [ - 'visible' => [ - ':input[name="footer_variation"]' => ['value' => 'mega'], + 'disabled' => [ + ':input[name="footer_variation"]' => ['value' => 'basic'], ], ], ]; @@ -89,8 +130,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'details', '#title' => $this->t('Footer Content'), '#states' => [ - 'visible' => [ - ':input[name="footer_variation"]' => ['value' => 'mega'], + 'disabled' => [ + ':input[name="footer_variation"]' => ['value' => 'basic'], ], ], ]; @@ -104,17 +145,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ], ], '#states' => [ - 'visible' => [ - ':input[name="footer_variation"]' => ['value' => 'mega'], - ], - ], - ]; - - $form['social_links'] = [ - '#type' => 'details', - '#title' => $this->t('Social Links'), - '#states' => [ - 'open' => [ + 'disabled' => [ ':input[name="footer_variation"]' => ['value' => 'basic'], ], ], diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml index 0da15c2266..dc37506b29 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.libraries.yml @@ -16,3 +16,5 @@ footer_settings_form: css: theme: css/footer-settings-form.css: {} + js: + js/footer-settings.js: {} From 2b9d49ededd4837ba79ec3dc51be347a81c507bb Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 31 Aug 2023 11:44:17 -0700 Subject: [PATCH 62/88] feat(YALB-1485): Minor styling and interactive changes suggested by Mike Tullo --- .../ys_core/css/footer-settings-form.css | 42 +++++++------------ .../{basic-footer.svg => footer-basic.svg} | 1 - .../{mega-footer.svg => footer-mega.svg} | 1 - .../custom/ys_core/js/footer-settings.js | 8 ++++ .../ys_core/src/Form/FooterSettingsForm.php | 4 +- 5 files changed, 24 insertions(+), 32 deletions(-) rename web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/{basic-footer.svg => footer-basic.svg} (95%) rename web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/{mega-footer.svg => footer-mega.svg} (97%) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css index cd0011c62b..b8d0b1506b 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/css/footer-settings-form.css @@ -40,6 +40,10 @@ display: flex; } +.footer-variation-radios .form-type--radio:first-child { + margin-left: 0; +} + .form-item--footer-variation.form-type--radio input { border: 0; clip: rect(0 0 0 0); @@ -52,35 +56,13 @@ } .form-item--footer-variation.form-type--radio label { - flex: 1 auto; - padding: var(--size-spacing-6) var(--size-spacing-4); - border-radius: 0.25rem; - border: 2px solid var(--color-border); - aspect-ratio: 2/1; - display: block !important; - text-align: left; + display: flex; + flex-direction: column; + align-items: center; background: var(--dark-theme-gray); - border: 2px solid white; - padding: var(--size-spacing-4) var(--size-spacing-5); - color: var(--color-text-primary); + border: 2px solid var(--wool); border-radius: 0.25rem; - margin-bottom: var(--size-spacing-4); - width: 178px; - height: 131px; -} - -.form-item--footer-variation input[value="basic"] + label { - background-image: url("../images/preview-icons/basic-footer.svg"); - background-repeat: no-repeat; - background-position: center -2px; - text-align: center; -} - -.form-item--footer-variation input[value="mega"] + label { - background-image: url("../images/preview-icons/mega-footer.svg"); - background-repeat: no-repeat; - background-position: center -2px; - text-align: center; + padding: 0.5rem; } .form-item--footer-variation input[checked="checked"] + label, @@ -89,6 +71,10 @@ .form-boolean--type-radio:hover input[checked="checked"] + label { - background-color: #3b3b3f; + background-color: var(--darkest-gray); color: var(--color-background-primary) !important; } + +.form-item--footer-variation.form-type--radio input:focus + label { + outline: 2px solid var(--wool); +} diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/basic-footer.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/footer-basic.svg similarity index 95% rename from web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/basic-footer.svg rename to web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/footer-basic.svg index 08557cbf6e..f7b9aaf832 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/basic-footer.svg +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/footer-basic.svg @@ -1,5 +1,4 @@ - diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/mega-footer.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/footer-mega.svg similarity index 97% rename from web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/mega-footer.svg rename to web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/footer-mega.svg index 4320100083..9302e300d9 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/mega-footer.svg +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/images/preview-icons/footer-mega.svg @@ -1,5 +1,4 @@ - diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js index 727e16330e..edb637c504 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/js/footer-settings.js @@ -5,6 +5,9 @@ function handleRadioInputs(radioGroup) { // Get references to the radio input elements within the specified group const radioInputs = document.querySelectorAll(radioGroup); + const detailGroups = document.querySelectorAll( + ".ys-core-footer-settings-form details" + ); // Add event listener to each radio input radioInputs.forEach((input) => { @@ -17,6 +20,11 @@ otherInput.removeAttribute("checked"); } }); + + // Closes all details after selecting a new footer variation. + for (let i = 0; i < detailGroups.length; i++) { + detailGroups[i].removeAttribute("open"); + } } }); }); diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index ed951687d2..549c5fb7a4 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -67,8 +67,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['footer_variation'] = [ '#type' => 'radios', '#options' => [ - 'basic' => $this->t('Basic'), - 'mega' => $this->t('Mega'), + 'basic' => $this->t('Basic') . 'Basic footer icon showing a small Yale logo, and gray placeholders for copyright and social media icons.', + 'mega' => $this->t('Mega') . 'Mega footer icon with gray placeholders for more information than the basic footer.', ], '#title' => $this->t('Footer variation'), '#default_value' => ($footerConfig->get('footer_variation')) ? $footerConfig->get('footer_variation') : 'basic', From 269f09d866aff9375e379eb8f30d4fc4900a56d3 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 31 Aug 2023 11:47:53 -0700 Subject: [PATCH 63/88] fix(YALB-1485): Fix merge conflict with css map file --- .../ys_admin_theme/scss/gin-custom.scss | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/web/themes/custom/ys_admin_theme/scss/gin-custom.scss b/web/themes/custom/ys_admin_theme/scss/gin-custom.scss index ffb7d71054..7b133a7f80 100644 --- a/web/themes/custom/ys_admin_theme/scss/gin-custom.scss +++ b/web/themes/custom/ys_admin_theme/scss/gin-custom.scss @@ -24,7 +24,7 @@ } // set select input background color so the text is legible. -.gin--dark-mode .form-element--type-select { +.gin--dark-mode .form-element--type-select { background-color: var(--dark-theme-gray); } @@ -33,13 +33,13 @@ } // Make admin content area darker than the top bar dark-theme-gray -.gin-layer-wrapper, -.block-system-main-block > form, -.views-exposed-form.views-exposed-form, -.views-edit-view, -.views-preview-wrapper, -#views-entity-list, -.module-filter-update-status-form .table-filter, +.gin-layer-wrapper, +.block-system-main-block > form, +.views-exposed-form.views-exposed-form, +.views-edit-view, +.views-preview-wrapper, +#views-entity-list, +.module-filter-update-status-form .table-filter, .admin.my-workbench { background-color: var(--dark-theme-gray) !important; } @@ -47,38 +47,38 @@ // remove box-shadows .gin--dark-mode .glb-claro-details__summary::after, .gin--dark-mode .messages, -.gin--dark-mode .gin-layer-wrapper, -.gin--dark-mode .gin-layer-wrapper-shadow, -.gin--dark-mode .block-system > form, -.gin--dark-mode .views-exposed-form.views-exposed-form, -.gin--dark-mode .views-edit-view, -.gin--dark-mode .views-preview-wrapper, -.gin--dark-mode .modules-tabs, -.gin--dark-mode .module-filter-update-status-form .table-filter, -.gin--dark-mode #views-entity-list, +.gin--dark-mode .gin-layer-wrapper, +.gin--dark-mode .gin-layer-wrapper-shadow, +.gin--dark-mode .block-system > form, +.gin--dark-mode .views-exposed-form.views-exposed-form, +.gin--dark-mode .views-edit-view, +.gin--dark-mode .views-preview-wrapper, +.gin--dark-mode .modules-tabs, +.gin--dark-mode .module-filter-update-status-form .table-filter, +.gin--dark-mode #views-entity-list, .gin--dark-mode .admin.my-workbench, -[dir="ltr"] .button--primary, -[dir="ltr"] .button--primary:not(:focus), +[dir="ltr"] .button--primary, +[dir="ltr"] .button--primary:not(:focus), [dir="ltr"] .ief-entity-submit, -.gin--dark-mode .glb-button, -.gin--dark-mode .inline-block-create-button, -.gin--dark-mode .layout-builder__link--add, -.gin--dark-mode .glb-button:not(:focus), -.gin--dark-mode .inline-block-create-button:not(:focus), -.gin--dark-mode .layout-builder__link--add:not(:focus), -.gin--dark-mode .form-actions .glb-button, -.gin--dark-mode .form-actions .inline-block-create-button, -.gin--dark-mode .form-actions .layout-builder__link--add, +.gin--dark-mode .glb-button, +.gin--dark-mode .inline-block-create-button, +.gin--dark-mode .layout-builder__link--add, +.gin--dark-mode .glb-button:not(:focus), +.gin--dark-mode .inline-block-create-button:not(:focus), +.gin--dark-mode .layout-builder__link--add:not(:focus), +.gin--dark-mode .form-actions .glb-button, +.gin--dark-mode .form-actions .inline-block-create-button, +.gin--dark-mode .form-actions .layout-builder__link--add, .gin--dark-mode .glb-action-link--icon-trash.glb-action-link, -.gin--dark-mode .glb-button, -.gin--dark-mode .inline-block-create-button, -.gin--dark-mode .layout-builder__link--add, -.gin--dark-mode .glb-button:not(:focus), -.gin--dark-mode .inline-block-create-button:not(:focus), -.gin--dark-mode .layout-builder__link--add:not(:focus), -.gin--dark-mode .form-actions .glb-button, -.gin--dark-mode .form-actions .inline-block-create-button, -.gin--dark-mode .form-actions .layout-builder__link--add, +.gin--dark-mode .glb-button, +.gin--dark-mode .inline-block-create-button, +.gin--dark-mode .layout-builder__link--add, +.gin--dark-mode .glb-button:not(:focus), +.gin--dark-mode .inline-block-create-button:not(:focus), +.gin--dark-mode .layout-builder__link--add:not(:focus), +.gin--dark-mode .form-actions .glb-button, +.gin--dark-mode .form-actions .inline-block-create-button, +.gin--dark-mode .form-actions .layout-builder__link--add, .gin--dark-mode .glb-action-link--icon-trash.glb-action-link { box-shadow: unset !important; } @@ -97,8 +97,8 @@ .gin--dark-mode .gin-secondary-toolbar.layout-container { background: rgba(var(--dark-theme-gray-rgb), 1); - margin-left: 0 !important; - margin-right: 0 !important; + margin-left: 0 !important; + margin-right: 0 !important; padding: 0.5rem 2rem; } @@ -108,7 +108,7 @@ } // toolbar overrides -.gin-secondary-toolbar .toolbar-secondary .toolbar-bar .toolbar-tab .toolbar-tray a:hover, +.gin-secondary-toolbar .toolbar-secondary .toolbar-bar .toolbar-tab .toolbar-tray a:hover, .gin-secondary-toolbar .toolbar-secondary .toolbar-bar .toolbar-tab .toolbar-tray a:active { background-color: var(--darkest-gray); } @@ -124,7 +124,7 @@ } -// Layout-builder +// Layout-builder .inline-block-create-button, .layout-builder__link--add, @@ -195,7 +195,7 @@ background: var(--dark-theme-gray); } -/* checkbox spacing */ +/* checkbox spacing */ .gin--dark-mode .js-form-type-checkbox.form-type--checkbox { padding: 0.5rem; } @@ -261,7 +261,7 @@ .upgrade-status-summary td.status-info-na { background-color: var(--gin-border-color-layer); color: var(--darkest-gray); -} +} .upgrade-status-summary td.status-info-unchecked { background-color: var(--gin-color-primary); color: var(--darkest-gray); @@ -289,7 +289,7 @@ /* Media library with PNGs */ .gin--dark-mode .glb-media-library-item__preview img[src*="png"] { background-color: var(--wool); -} +} /* Embed component */ .gin--dark-mode .ui-dialog .ui-widget-content.ui-dialog-content h2 { From 64dd3bc6e4f7fd8498cfd7ae01d8607adac574f6 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 31 Aug 2023 12:32:24 -0700 Subject: [PATCH 64/88] chore(YALB-1485): Add dependencies --- .../modules/custom/ys_core/src/Form/FooterSettingsForm.php | 4 ++-- .../yalesites_profile/modules/custom/ys_core/ys_core.info.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php index 549c5fb7a4..0ccbad82c9 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/src/Form/FooterSettingsForm.php @@ -102,13 +102,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['desc_basic_container']['desc_basic'] = [ '#type' => 'markup', '#prefix' => '

Basic Footer

', - '#markup' => $this->t('The basic footer of your website contains only social media icons and Yale branding.'), + '#markup' => '

' . $this->t('The basic footer of your website contains only social media icons and Yale branding.') . '

', ]; $form['desc_mega_container']['desc_mega'] = [ '#type' => 'markup', '#prefix' => '

Mega Footer

', - '#markup' => $this->t('The mega footer of your website can be customized to suit your organizational needs. You can upload icons for various organizational identities and other platforms that your organization uses. You can also add a customizable text area with general information, contact information, or a physical address. Additionally, you can add up to 8 links in a two-column format.'), + '#markup' => '

' . $this->t('The mega footer of your website can be customized to suit your organizational needs. You can upload icons for various organizational identities and other platforms that your organization uses. You can also add a customizable text area with general information, contact information, or a physical address. Additionally, you can add up to 8 links in a two-column format.') . '

', ]; $form['social_links'] = [ diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml index 5094cd944c..4f6bef2220 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml @@ -3,3 +3,6 @@ type: module description: YaleSites Core Configuation core_version_requirement: '^9 || ^10' package: YaleSites +dependencies: + - multivalue_form_element + - media_library_form_element From 7166cdeec61f613b2166fdf8d267c40009e14521 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 31 Aug 2023 12:58:26 -0700 Subject: [PATCH 65/88] chore(YALB-1510): Add dependency --- .../yalesites_profile/modules/custom/ys_core/ys_core.info.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml index 5094cd944c..0a1d85fde8 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_core/ys_core.info.yml @@ -3,3 +3,5 @@ type: module description: YaleSites Core Configuation core_version_requirement: '^9 || ^10' package: YaleSites +dependencies: + - menu_item_extras From ecc1ab6f2f4c73a7f300fe7a30d4ec668d3d7e76 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 31 Aug 2023 15:24:38 -0500 Subject: [PATCH 66/88] fix(yalb-1215): make heading level required, for now, to remove -none- option --- ...field.field.block_content.cta_banner.field_heading_level.yml | 2 +- ...field.field.block_content.grand_hero.field_heading_level.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml index 009478cb93..834c057cfa 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.cta_banner.field_heading_level.yml @@ -13,7 +13,7 @@ entity_type: block_content bundle: cta_banner label: 'Heading Level' description: 'Optionally override heading level for this banner' -required: false +required: true translatable: false default_value: - diff --git a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml index 346db4171a..8880554a31 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/field.field.block_content.grand_hero.field_heading_level.yml @@ -13,7 +13,7 @@ entity_type: block_content bundle: grand_hero label: 'Heading Level' description: 'Optionally override heading level for this banner' -required: false +required: true translatable: true default_value: - From 09edc1a15762e21c8ba0a99c2911bc409143832c Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 31 Aug 2023 16:07:18 -0500 Subject: [PATCH 67/88] fix(yalb-1312): add icons for event time period, refine styles --- .../ys_views_basic/assets/css/views-basic.css | 58 ++++++++----------- .../assets/icons/event-time-all.svg | 3 + .../assets/icons/event-time-future.svg | 4 ++ .../assets/icons/event-time-past.svg | 4 ++ .../FieldWidget/ViewsBasicDefaultWidget.php | 6 +- 5 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-all.svg create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-future.svg create mode 100644 web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-past.svg diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css index 46029f4926..becb9df0b6 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/css/views-basic.css @@ -2,20 +2,6 @@ * @todo Possibly move these styles into admin theme. */ -/* set variables */ -.layout-builder-configure-block { - --color-border: var(--wool); - --color-border-lightest: var(--color-basic-white); - --color-link-hover: hsl(210, 100%, 21%); - --color-link-border: #187e9b; - --color-background-primary: var(--color-basic-white); - --color-background-hover: var(--dark-theme-gray); - --color-border-hover: var(--darkest-gray); - --color-text-lighter: #2D424D; - --color-text-primary: var(--color-gray-800); -} - - /* General styles */ .views-basic--params { display: none; @@ -61,22 +47,26 @@ } /* base for labels */ -.glb-form-type--radio label { +.glb-form-type--radio label.glb-form-item__label.glb-option { + display: flex !important; + align-items: center; + flex-direction: column; + gap: 1rem; flex: 1 auto; - padding: var(--size-spacing-6) var(--size-spacing-4); - border-radius: 0.25rem; - border: 2px solid var(--color-border); + border: 2px solid var(--wool); aspect-ratio: 2/1; - display: block !important; text-align: left; - background: var(--dark-theme-gray); - border: 2px solid var(--color-border); + background-color: var(--dark-theme-gray); padding: var(--size-spacing-4) var(--size-spacing-5); - color: var(--color-text-primary); + color: var(--darkest-gray); border-radius: 0.25rem; margin-bottom: var(--size-spacing-4); } +.glb-form-type--radio label.glb-form-item__label.glb-option:hover { + border-color: var(--darkest-gray); +} + /****** /******** Input styles @@ -215,15 +205,15 @@ .layout-builder-configure-block .form-item-settings-block-form-group-user-selection-entity-and-view-mode-entity-types:focus label, .layout-builder-configure-block .form-item-settings-block-form-group-user-selection-entity-and-view-mode-view-mode:hover label, .layout-builder-configure-block .form-item-settings-block-form-group-user-selection-entity-and-view-mode-view-mode:focus label { - background-color: var(--color-background-hover); - border-color: var(--color-border-hover); + background-color: var(--dark-theme-gray); + border-color: var(--darkest-gray); } .layout-builder-configure-block .glb-form-type--radio input[checked="checked"] + label, .layout-builder-configure-block .glb-form-type--radio input[checked="checked"] + label:hover, .layout-builder-configure-block .glb-form-type--radio:hover input[checked="checked"] + label { - background-color: var(--color-text-primary); - color: var(--color-background-primary) !important; + background-color: var(--darkest-gray); + color: var(--wool) !important; } @@ -239,8 +229,8 @@ } .form-item-settings-block-form-group-user-selection-entity-and-view-mode-entity-types input[value="post"][checked="checked"] + label { - background-color: var(--color-text-primary); - color: var(--color-background-primary); + background-color: var(--darkest-gray); + color: var(--wool); } @@ -252,8 +242,8 @@ } .form-item-settings-block-form-group-user-selection-entity-and-view-mode-entity-types input[value="event"][checked="checked"] + label { - background-color: var(--color-text-primary); - color: var(--color-background-primary); + background-color: var(--darkest-gray); + color: var(--wool); } /* Pages */ @@ -264,8 +254,8 @@ } .form-item-settings-block-form-group-user-selection-entity-and-view-mode-entity-types input[value="page"][checked="checked"] + label { - background-color: var(--color-text-primary); - color: var(--color-background-primary); + background-color: var(--darkest-gray); + color: var(--wool); } /* Profiles */ @@ -276,8 +266,8 @@ } .form-item-settings-block-form-group-user-selection-entity-and-view-mode-entity-types input[value="profile"][checked="checked"] + label { - background-color: var(--color-text-primary); - color: var(--color-background-primary); + background-color: var(--darkest-gray); + color: var(--wool); } /* diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-all.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-all.svg new file mode 100644 index 0000000000..5e8d11320f --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-all.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-future.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-future.svg new file mode 100644 index 0000000000..30f8f043cd --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-future.svg @@ -0,0 +1,4 @@ + + + + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-past.svg b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-past.svg new file mode 100644 index 0000000000..b87e2948f4 --- /dev/null +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/assets/icons/event-time-past.svg @@ -0,0 +1,4 @@ + + + + diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php index f5a404f7fc..63de29b24a 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php @@ -279,9 +279,9 @@ public function formElement( '#type' => 'radios', '#title' => $this->t('Event Time Period'), '#options' => [ - 'future' => $this->t('Future Events'), - 'past' => $this->t('Past Events'), - 'all' => $this->t('All Events'), + 'future' => $this->t('Future Events' . 'Future Events icon showing a calendar with a future-pointing arrow to the right.'), + 'past' => $this->t('Past Events' . 'Past Events icon showing a calendar with a past-pointing arrow to the left.'), + 'all' => $this->t('All Events' . 'All Events icon showing a calendar.'), ], '#default_value' => ($items[$delta]->params) ? $this->viewsBasicManager->getDefaultParamValue('event_time_period', $items[$delta]->params) : 'future', '#states' => [ From 29b4f7be862099a17bb86430a5ddab276f635096 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 31 Aug 2023 16:20:40 -0500 Subject: [PATCH 68/88] fix(yalb-1312): fix closing parenthesis --- .../Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php index 63de29b24a..1abbc41915 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php @@ -279,9 +279,9 @@ public function formElement( '#type' => 'radios', '#title' => $this->t('Event Time Period'), '#options' => [ - 'future' => $this->t('Future Events' . 'Future Events icon showing a calendar with a future-pointing arrow to the right.'), - 'past' => $this->t('Past Events' . 'Past Events icon showing a calendar with a past-pointing arrow to the left.'), - 'all' => $this->t('All Events' . 'All Events icon showing a calendar.'), + 'future' => $this->t('Future Events') . 'Future Events icon showing a calendar with a future-pointing arrow to the right.', + 'past' => $this->t('Past Events') . 'Past Events icon showing a calendar with a past-pointing arrow to the left.', + 'all' => $this->t('All Events') . 'All Events icon showing a calendar.', ], '#default_value' => ($items[$delta]->params) ? $this->viewsBasicManager->getDefaultParamValue('event_time_period', $items[$delta]->params) : 'future', '#states' => [ From 7ec0e3b4efa557438377cf51dae58bd2032bcb73 Mon Sep 17 00:00:00 2001 From: Joe Tower Date: Thu, 31 Aug 2023 16:34:40 -0500 Subject: [PATCH 69/88] fix(yalb-1312): fix space in concat --- .../src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php index 1abbc41915..0f2605d626 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_views_basic/src/Plugin/Field/FieldWidget/ViewsBasicDefaultWidget.php @@ -280,7 +280,7 @@ public function formElement( '#title' => $this->t('Event Time Period'), '#options' => [ 'future' => $this->t('Future Events') . 'Future Events icon showing a calendar with a future-pointing arrow to the right.', - 'past' => $this->t('Past Events') . 'Past Events icon showing a calendar with a past-pointing arrow to the left.', + 'past' => $this->t('Past Events') . 'Past Events icon showing a calendar with a past-pointing arrow to the left.', 'all' => $this->t('All Events') . 'All Events icon showing a calendar.', ], '#default_value' => ($items[$delta]->params) ? $this->viewsBasicManager->getDefaultParamValue('event_time_period', $items[$delta]->params) : 'future', From b0fe66538cecc44cd7c3d7ef5a331256e0750290 Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 31 Aug 2023 17:19:55 -0700 Subject: [PATCH 70/88] feat(YALB-1291): WIP upgrading from CKEditor 4 to CKEditor 5 --- .../config/sync/captcha.settings.yml | 6 +- .../config/sync/core.extension.yml | 1 + .../config/sync/editor.editor.basic_html.yml | 97 +++++++++++-------- .../sync/editor.editor.webform_default.yml | 47 +++++++++ .../config/sync/filter.format.basic_html.yml | 2 +- .../sync/filter.format.webform_default.yml | 12 +++ 6 files changed, 121 insertions(+), 44 deletions(-) create mode 100644 web/profiles/custom/yalesites_profile/config/sync/editor.editor.webform_default.yml create mode 100644 web/profiles/custom/yalesites_profile/config/sync/filter.format.webform_default.yml diff --git a/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml b/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml index de16739de7..1a9aa1b1f0 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/captcha.settings.yml @@ -1,14 +1,14 @@ _core: default_config_hash: hSAUW7BoAd9YUpKcVKyZpW4wY67g4XZAYlt3Vnz6SVA +enabled_default: 0 default_challenge: recaptcha_v3/form_submission description: 'This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.' administration_mode: false +allow_on_admin_pages: false whitelist_ips: '' +add_captcha_description: true wrong_captcha_response_message: 'The answer you entered for the CAPTCHA was not correct.' default_validation: 1 persistence: 1 enable_stats: false log_wrong_responses: false -enabled_default: 0 -allow_on_admin_pages: false -add_captcha_description: true diff --git a/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml b/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml index 10b54f0fb2..6d2297c1d1 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/core.extension.yml @@ -20,6 +20,7 @@ module: chosen_field: 0 chosen_lib: 0 ckeditor: 0 + ckeditor5: 0 components: 0 config: 0 config_filter: 0 diff --git a/web/profiles/custom/yalesites_profile/config/sync/editor.editor.basic_html.yml b/web/profiles/custom/yalesites_profile/config/sync/editor.editor.basic_html.yml index 5dbcfcf772..62ef1a6d28 100644 --- a/web/profiles/custom/yalesites_profile/config/sync/editor.editor.basic_html.yml +++ b/web/profiles/custom/yalesites_profile/config/sync/editor.editor.basic_html.yml @@ -1,53 +1,70 @@ -uuid: 23681889-3337-49e5-af58-b61087d99a4f +uuid: 05e16a5b-5ad6-4c77-a471-73fa64268cd1 langcode: en status: true dependencies: config: - filter.format.basic_html module: - - ckeditor + - ckeditor5 format: basic_html -editor: ckeditor +editor: ckeditor5 settings: toolbar: - rows: - - - - - name: Formatting - items: - - Bold - - Italic - - JustifyLeft - - JustifyCenter - - JustifyRight - - Format - - '-' - - Paste - - PasteText - - - name: Links - items: - - DrupalLink - - DrupalUnlink - - - name: Lists - items: - - BulletedList - - NumberedList - - Outdent - - Indent - - - name: Media - items: - - Table - - - name: Tools - items: - - Source - - Maximize - - '-' + items: + - bold + - italic + - alignment + - heading + - '|' + - link + - '|' + - bulletedList + - numberedList + - outdent + - indent + - '|' + - insertTable + - '|' + - sourceEditing + - '|' + - blockQuote + - code + - superscript + - subscript plugins: - drupallink: + ckeditor5_heading: + enabled_headings: + - heading2 + - heading3 + - heading4 + - heading5 + - heading6 + ckeditor5_sourceEditing: + allowed_tags: + - '' + - '
' + - '
' + - '
' + - '' + - '
' + - '