diff --git a/CHANGELOG.md b/CHANGELOG.md index b0aaca79cb038377950f07afa58483840285d67f..937b7a57ff352eeb68e988cba49193d16f6399b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,47 @@ # Change Log +## [1.0.0-beta2](https://github.com/openeuropa/oe_whitelabel/tree/1.0.0-beta2) (2022-05-23) +[Full Changelog](https://github.com/openeuropa/oe_whitelabel/compare/1.0.0-beta1...1.0.0-beta2) + +**Merged pull requests:** + +- OEL-1632: Add upgrade hooks for moving content banner into block. [\#147](https://github.com/openeuropa/oe_whitelabel/pull/147) ([donquixote](https://github.com/donquixote)) + +## [1.0.0-beta1](https://github.com/openeuropa/oe_whitelabel/tree/1.0.0-beta1) (2022-05-20) +[Full Changelog](https://github.com/openeuropa/oe_whitelabel/compare/1.0.0-alpha7...1.0.0-beta1) + +**Closed issues:** + +- The header pattern displays an empty navbar when both regions are empty [\#50](https://github.com/openeuropa/oe_whitelabel/issues/50) + +**Merged pull requests:** + +- Prepare dependencies for release 1.0.0-beta1 [\#146](https://github.com/openeuropa/oe_whitelabel/pull/146) ([drishu](https://github.com/drishu)) +- Prepare release 1.0.0-beta1 [\#145](https://github.com/openeuropa/oe_whitelabel/pull/145) ([drishu](https://github.com/drishu)) +- OEL-1585: Fix logo url link in neutral flavour and test coverage. [\#142](https://github.com/openeuropa/oe_whitelabel/pull/142) ([escuriola](https://github.com/escuriola)) +- Update EPIC-1293-Project [\#140](https://github.com/openeuropa/oe_whitelabel/pull/140) ([donquixote](https://github.com/donquixote)) +- OEL-0000: Remove explicit version requirement for drupal/remote\_stream\_wrapper [\#134](https://github.com/openeuropa/oe_whitelabel/pull/134) ([donquixote](https://github.com/donquixote)) +- OEL-1528: Fix whitelabel issues on template, composer and dependencies. [\#133](https://github.com/openeuropa/oe_whitelabel/pull/133) ([Maxfire](https://github.com/Maxfire)) +- OEL-0000: Fix remote\_stream\_wrapper version to 1.5.0 temporarily. [\#132](https://github.com/openeuropa/oe_whitelabel/pull/132) ([donquixote](https://github.com/donquixote)) +- OEL-1536: Specify extension type when using ConfigImporter. [\#131](https://github.com/openeuropa/oe_whitelabel/pull/131) ([donquixote](https://github.com/donquixote)) +- OEL-1525: Uninitialized config keys in SearchBlock [\#130](https://github.com/openeuropa/oe_whitelabel/pull/130) ([donquixote](https://github.com/donquixote)) +- OEL-1452: Escaped markup in description list paragraph. [\#127](https://github.com/openeuropa/oe_whitelabel/pull/127) ([brummbar](https://github.com/brummbar)) +- OEL-1374: Search page look & feel update [\#126](https://github.com/openeuropa/oe_whitelabel/pull/126) ([escuriola](https://github.com/escuriola)) +- OEL-1453: Consolidate theme regions [\#125](https://github.com/openeuropa/oe_whitelabel/pull/125) ([escuriola](https://github.com/escuriola)) +- OEL-1416: Fix tests for BCL 0.22.0 [\#124](https://github.com/openeuropa/oe_whitelabel/pull/124) ([donquixote](https://github.com/donquixote)) +- OEL-1357: README improvements [\#123](https://github.com/openeuropa/oe_whitelabel/pull/123) ([donquixote](https://github.com/donquixote)) +- OEL-1425: Use imageValueObject on oe\_whitelabel. [\#118](https://github.com/openeuropa/oe_whitelabel/pull/118) ([escuriola](https://github.com/escuriola)) +- EPIC-1293-Project [\#109](https://github.com/openeuropa/oe_whitelabel/pull/109) ([Maxfire](https://github.com/Maxfire)) +- OEL-1227: Move content banner into a block. [\#101](https://github.com/openeuropa/oe_whitelabel/pull/101) ([donquixote](https://github.com/donquixote)) +- OEL-1317: Improve navbar search form. [\#100](https://github.com/openeuropa/oe_whitelabel/pull/100) ([escuriola](https://github.com/escuriola)) +- OEL-486: Improve test coverage [\#89](https://github.com/openeuropa/oe_whitelabel/pull/89) ([drishu](https://github.com/drishu)) + ## [1.0.0-alpha7](https://github.com/openeuropa/oe_whitelabel/tree/1.0.0-alpha7) (2022-04-08) [Full Changelog](https://github.com/openeuropa/oe_whitelabel/compare/1.0.0-alpha6...1.0.0-alpha7) **Merged pull requests:** +- Prepare release 1.0.0-alpha7 [\#120](https://github.com/openeuropa/oe_whitelabel/pull/120) ([abel-santos-corral](https://github.com/abel-santos-corral)) - OEL-1434: Filter out bundles if no legacy fields present [\#119](https://github.com/openeuropa/oe_whitelabel/pull/119) ([abel-santos-corral](https://github.com/abel-santos-corral)) ## [1.0.0-alpha6](https://github.com/openeuropa/oe_whitelabel/tree/1.0.0-alpha6) (2022-04-07) diff --git a/composer.json b/composer.json index f6ff4b4eafc5186752bb00e171d14b1e4cfd7d79..774d4adf31c22832ed9cfec63c8dd9bfa193ee78 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "drupal/core": "^9.2", "drupal/twig_field_value": "^2.0", "openeuropa/composer-artifacts": "^1.0.0-alpha1", - "openeuropa/oe_bootstrap_theme": "0.1.202204221756" + "openeuropa/oe_bootstrap_theme": "1.0.0-beta1" }, "require-dev": { "composer/installers": "^1.11", @@ -44,7 +44,7 @@ "openeuropa/oe_media": "^1.14", "openeuropa/oe_multilingual": "^1.9", "openeuropa/oe_paragraphs": "^1.13", - "openeuropa/oe_starter_content": "1.x-dev", + "openeuropa/oe_starter_content": "^1.0.0-beta1", "openeuropa/task-runner-drupal-project-symlink": "^1.0-beta5", "phpspec/prophecy-phpunit": "^2", "symfony/dom-crawler": "^4.4.12" @@ -57,10 +57,6 @@ "drupal":{ "type": "composer", "url": "https://packages.drupal.org/8" - }, - "openeuropa/oe_starter_content": { - "type": "git", - "url": "https://github.com/openeuropa/oe_starter_content" } }, "autoload": { @@ -85,11 +81,6 @@ } } }, - "patches": { - "openeuropa/oe_bootstrap_theme": { - "latest": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1.202204221756..1.x.diff" - } - }, "drupal-scaffold": { "locations": { "web-root": "./build" diff --git a/modules/oe_whitelabel_helper/config/post_updates/00001_content_banner/block.block.oe_whitelabel_content_banner.yml b/modules/oe_whitelabel_helper/config/post_updates/00001_content_banner/block.block.oe_whitelabel_content_banner.yml new file mode 100644 index 0000000000000000000000000000000000000000..a7739a8290bea8d780fbe477992b073c0982ad69 --- /dev/null +++ b/modules/oe_whitelabel_helper/config/post_updates/00001_content_banner/block.block.oe_whitelabel_content_banner.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + module: + - node + theme: + - oe_whitelabel +id: oe_whitelabel_content_banner +theme: oe_whitelabel +region: hero +weight: -6 +provider: null +plugin: oe_w_content_banner +settings: + id: oe_w_content_banner + label: 'Content banner' + label_display: '0' + provider: node + context_mapping: + node: '@node.node_route_context:node' +visibility: { } diff --git a/modules/oe_whitelabel_helper/config/post_updates/00001_content_banner/core.entity_view_mode.node.oe_w_content_banner.yml b/modules/oe_whitelabel_helper/config/post_updates/00001_content_banner/core.entity_view_mode.node.oe_w_content_banner.yml new file mode 100644 index 0000000000000000000000000000000000000000..f9fd090f85d463538ab1fbad052f07781d8d04f4 --- /dev/null +++ b/modules/oe_whitelabel_helper/config/post_updates/00001_content_banner/core.entity_view_mode.node.oe_w_content_banner.yml @@ -0,0 +1,9 @@ +langcode: en +status: true +dependencies: + module: + - node +id: node.oe_w_content_banner +label: 'Content banner' +targetEntityType: node +cache: true diff --git a/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml b/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml index 3eb3f1ffa8b0d388ac7b7c30a638196115007185..210d21be2ad7fb4cdc8704053c6291c557a5acea 100644 --- a/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml +++ b/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml @@ -6,6 +6,7 @@ core_version_requirement: ^9.2 dependencies: - drupal:node + - drupal:twig_field_value - oe_bootstrap_theme:oe_bootstrap_theme_helper - openeuropa:oe_corporate_blocks diff --git a/modules/oe_whitelabel_helper/oe_whitelabel_helper.post_update.php b/modules/oe_whitelabel_helper/oe_whitelabel_helper.post_update.php new file mode 100644 index 0000000000000000000000000000000000000000..d82ac1650beefa35d6ce05d2717991f990bf6ec2 --- /dev/null +++ b/modules/oe_whitelabel_helper/oe_whitelabel_helper.post_update.php @@ -0,0 +1,21 @@ +<?php + +/** + * @file + * Post update hooks. + */ + +declare(strict_types = 1); + +use Drupal\oe_bootstrap_theme\ConfigImporter; + +/** + * Move content banner into a block. + */ +function oe_whitelabel_helper_post_update_00001(): void { + $configs = [ + 'block.block.oe_whitelabel_content_banner', + 'core.entity_view_mode.node.oe_w_content_banner', + ]; + ConfigImporter::importMultiple('module', 'oe_whitelabel_helper', '/config/post_updates/00001_content_banner', $configs, TRUE); +} diff --git a/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php b/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php index bd4d89656993ac4b5895346957f73ce8ac56c6e2..c5adf7941d7d618e040b367c4fa9a3762e314c1a 100644 --- a/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php +++ b/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php @@ -22,10 +22,25 @@ class FloatEndSortWidget extends DefaultWidget { */ public function exposedFormAlter(array &$form, FormStateInterface $form_state) { parent::exposedFormAlter($form, $form_state); - $form['#attributes']['class'][] = 'float-lg-end'; - $form['#attributes']['class'][] = 'd-none'; - $form['#attributes']['class'][] = 'd-md-flex'; - $form['#attributes']['class'][] = 'align-items-baseline'; + + // @todo This will be done via theming in OEL-1583. + $form['#attributes']['class'][] = 'col-lg-4'; + $form['#attributes']['class'][] = 'col-md-6'; + $form['#attributes']['class'][] = 'mt-3'; + $form['#attributes']['class'][] = 'mt-md-0'; + + if (empty($form['sort_bef_combine'])) { + return; + } + + $form['sort_bef_combine']['#attributes']['class'][] = 'ms-md-2'; + $form['sort_bef_combine']['#label_attributes']['class'][] = 'mb-0'; + $form['sort_bef_combine']['#label_attributes']['class'][] = 'text-nowrap'; + $form['sort_bef_combine']['#wrapper_attributes']['class'][] = 'align-items-center'; + $form['sort_bef_combine']['#wrapper_attributes']['class'][] = 'd-md-flex'; + $form['sort_bef_combine']['#wrapper_attributes']['class'][] = 'float-md-end'; + $form['sort_bef_combine']['#wrapper_attributes']['class'][] = 'mb-4'; + $form['sort_bef_combine']['#wrapper_attributes']['class'][] = 'mb-md-0'; } } diff --git a/modules/oe_whitelabel_helper/tests/src/Kernel/Plugin/better_exposed_filters/sort/FloatEndSortWidgetTest.php b/modules/oe_whitelabel_helper/tests/src/Kernel/Plugin/better_exposed_filters/sort/FloatEndSortWidgetTest.php index 2b799fca8c92c1d89d0d6f5d0bfce73e3976a68b..f9a2a901c1d49ed7fd301496c18bb739d27f232a 100644 --- a/modules/oe_whitelabel_helper/tests/src/Kernel/Plugin/better_exposed_filters/sort/FloatEndSortWidgetTest.php +++ b/modules/oe_whitelabel_helper/tests/src/Kernel/Plugin/better_exposed_filters/sort/FloatEndSortWidgetTest.php @@ -46,6 +46,7 @@ class FloatEndSortWidgetTest extends BetterExposedFiltersKernelTestBase { $view->storage->getDisplay('default'); $this->setBetterExposedOptions($view, [ + // @todo Add combined sort. 'sort' => [ 'plugin_id' => 'oe_whitelabel_float_end_sort', ], @@ -54,10 +55,10 @@ class FloatEndSortWidgetTest extends BetterExposedFiltersKernelTestBase { // Render the exposed form. $this->renderExposedForm($view); $crawler = new Crawler($this->content->__toString()); - $widget = $crawler->filter('form.bef-exposed-form'); + $this->assertCount(1, $widget); - $this->assertStringContainsString('float-lg-end d-none d-md-flex align-items-baseline', $widget->attr('class')); + $this->assertStringContainsString('col-lg-4 col-md-6 mt-3 mt-md-0', $widget->attr('class')); $view->destroy(); } diff --git a/modules/oe_whitelabel_list_pages/tests/src/Functional/ListPagesTest.php b/modules/oe_whitelabel_list_pages/tests/src/Functional/ListPagesTest.php index 44b8bdfa5e686968b76ebc049bc131c1e8cd2827..38a9f5db30193c017fe5c7e385a8c178f10d5849 100644 --- a/modules/oe_whitelabel_list_pages/tests/src/Functional/ListPagesTest.php +++ b/modules/oe_whitelabel_list_pages/tests/src/Functional/ListPagesTest.php @@ -95,7 +95,7 @@ class ListPagesTest extends WhitelabelBrowserTestBase { $assert_session->elementsCount('css', 'div.listing-item', '10'); // Assert pagination. $assert_session->elementExists('css', 'nav > ul.pagination'); - $assert_session->elementsCount('css', 'ul.pagination > li.page-item', 3); + $assert_session->elementsCount('css', 'ul.pagination > li.page-item', 4); // Assert search. $page->fillField('Title', 'News number 8'); diff --git a/modules/oe_whitelabel_search/oe_whitelabel_search.module b/modules/oe_whitelabel_search/oe_whitelabel_search.module new file mode 100644 index 0000000000000000000000000000000000000000..abd7c78c35396960d3ab9d3225bf74f6d0b69156 --- /dev/null +++ b/modules/oe_whitelabel_search/oe_whitelabel_search.module @@ -0,0 +1,51 @@ +<?php + +/** + * @file + * OE Whitelabel Search Module. + */ + +declare(strict_types = 1); + +use Drupal\Core\Form\FormStateInterface; + +/** + * Implements hook_form_FORM_ID_alter() for facets_forms. + */ +function oe_whitelabel_search_form_facets_form_alter(&$form, FormStateInterface $form_state, $form_id): void { + if (isset($form['actions'])) { + $action_classes = ['mt-4', 'd-grid', 'gap-4', 'd-md-block']; + if (!isset($form['actions']['#attributes']['class'])) { + $form['actions']['#attributes']['class'] = []; + } + $form['actions']['#attributes']['class'] = array_merge($form['actions']['#attributes']['class'], $action_classes); + } + if (isset($form['actions']['submit'])) { + $submit_classes = ['me-md-3', 'btn', 'btn-primary', 'btn-md']; + if (!isset($form['actions']['submit']['#attributes']['class'])) { + $form['actions']['submit']['#attributes']['class'] = []; + } + $form['actions']['submit']['#attributes']['class'] = array_merge($form['actions']['submit']['#attributes']['class'], $submit_classes); + } + if (isset($form['actions']['reset'])) { + $reset_classes = ['btn', 'btn-light', 'btn-md']; + if (!isset($form['actions']['reset']['#attributes']['class'])) { + $form['actions']['reset']['#attributes']['class'] = []; + } + $form['actions']['reset']['#attributes']['class'] = array_merge($form['actions']['reset']['#attributes']['class'], $reset_classes); + } +} + +/** + * Implements hook_preprocess_HOOK() for facet_summary_item_list. + */ +function oe_whitelabel_search_preprocess_facets_summary_item_list(array &$variables): void { + $items = []; + foreach ($variables['items'] as $item) { + if ($item['value']['#type'] === 'link') { + $item['value']['#attributes']['class'] = 'standalone'; + $items[] = $item; + } + } + $variables['items'] = $items; +} diff --git a/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.full.yml b/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.full.yml new file mode 100755 index 0000000000000000000000000000000000000000..6ad2e19b4a71f0579a0b35ac5cb7087f03a1879c --- /dev/null +++ b/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.full.yml @@ -0,0 +1,69 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.full + - field.field.node.oe_sc_event.body + - field.field.node.oe_sc_event.oe_documents + - field.field.node.oe_sc_event.oe_featured_media + - field.field.node.oe_sc_event.oe_sc_event_dates + - field.field.node.oe_sc_event.oe_sc_event_location + - field.field.node.oe_sc_event.oe_summary + - node.type.oe_sc_event + module: + - datetime_range + - oe_whitelabel_helper + - text + - user +id: node.oe_sc_event.full +targetEntityType: node +bundle: oe_sc_event +mode: full +content: + body: + type: text_default + label: above + settings: { } + third_party_settings: { } + weight: 0 + region: content + links: + settings: { } + third_party_settings: { } + weight: 4 + region: content + oe_documents: + type: entity_reference_entity_view + label: above + settings: + view_mode: default + link: true + third_party_settings: { } + weight: 3 + region: content + oe_sc_event_dates: + type: daterange_default + label: inline + settings: + timezone_override: '' + format_type: oe_whitelabel_starter_event_date + separator: to + third_party_settings: { } + weight: 1 + region: content + oe_sc_event_location: + type: oe_whitelabel_helper_address_inline + label: inline + settings: + delimiter: ', ' + third_party_settings: { } + weight: 2 + region: content +hidden: + langcode: true + oe_content_content_owner: true + oe_content_legacy_link: true + oe_content_navigation_title: true + oe_content_short_title: true + oe_featured_media: true + oe_summary: true diff --git a/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.oe_w_content_banner.yml b/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.oe_w_content_banner.yml new file mode 100644 index 0000000000000000000000000000000000000000..f6d0cd2adc32860b19f61da1d6f7a2ff472c54a0 --- /dev/null +++ b/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.oe_w_content_banner.yml @@ -0,0 +1,47 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.oe_w_content_banner + - field.field.node.oe_sc_event.body + - field.field.node.oe_sc_event.oe_documents + - field.field.node.oe_sc_event.oe_featured_media + - field.field.node.oe_sc_event.oe_sc_event_dates + - field.field.node.oe_sc_event.oe_sc_event_location + - field.field.node.oe_sc_event.oe_summary + - node.type.oe_sc_event + module: + - oe_content_featured_media_field + - text + - user +id: node.oe_sc_event.oe_w_content_banner +targetEntityType: node +bundle: oe_sc_event +mode: oe_w_content_banner +content: + oe_featured_media: + type: oe_featured_media_label + label: hidden + settings: + link: true + third_party_settings: { } + weight: 1 + region: content + oe_summary: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 0 + region: content +hidden: + body: true + langcode: true + links: true + oe_content_content_owner: true + oe_content_legacy_link: true + oe_content_navigation_title: true + oe_content_short_title: true + oe_documents: true + oe_sc_event_dates: true + oe_sc_event_location: true diff --git a/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.teaser.yml b/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.teaser.yml new file mode 100755 index 0000000000000000000000000000000000000000..6233984402ee68232bd4f5d50236783222a39d79 --- /dev/null +++ b/modules/oe_whitelabel_starter_event/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_event.teaser.yml @@ -0,0 +1,56 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.oe_sc_event.body + - field.field.node.oe_sc_event.oe_documents + - field.field.node.oe_sc_event.oe_featured_media + - field.field.node.oe_sc_event.oe_sc_event_dates + - field.field.node.oe_sc_event.oe_sc_event_location + - field.field.node.oe_sc_event.oe_summary + - node.type.oe_sc_event + module: + - address + - datetime_range + - text + - user +id: node.oe_sc_event.teaser +targetEntityType: node +bundle: oe_sc_event +mode: teaser +content: + oe_sc_event_dates: + type: daterange_default + label: hidden + settings: + timezone_override: '' + format_type: oe_whitelabel_starter_event_date + separator: to + third_party_settings: { } + weight: 4 + region: content + oe_sc_event_location: + type: address_default + label: hidden + settings: { } + third_party_settings: { } + weight: 5 + region: content + oe_summary: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 2 + region: content +hidden: + body: true + langcode: true + links: true + oe_content_content_owner: true + oe_content_legacy_link: true + oe_content_navigation_title: true + oe_content_short_title: true + oe_documents: true + oe_featured_media: true diff --git a/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.info.yml b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.info.yml index 2b18cf024a54fe9aad5a668370bf28150ea26703..4ed9284af0292d3f6b4fd771a7357687a56e6a3f 100755 --- a/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.info.yml +++ b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.info.yml @@ -4,7 +4,6 @@ description: Adds additional functionality to the Event module package: OpenEuropa Whitelabel Theme core_version_requirement: ^9.2 dependencies: - - drupal:twig_field_value - oe_whitelabel:oe_whitelabel_helper - oe_starter_content:oe_starter_content_event diff --git a/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.post_update.php b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.post_update.php new file mode 100644 index 0000000000000000000000000000000000000000..fe1ab7d35472c1a327d9a702aa1496abf3880923 --- /dev/null +++ b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.post_update.php @@ -0,0 +1,22 @@ +<?php + +/** + * @file + * Post update hooks. + */ + +declare(strict_types = 1); + +use Drupal\oe_bootstrap_theme\ConfigImporter; + +/** + * Move content banner into a block. + */ +function oe_whitelabel_starter_event_post_update_00001(): void { + $configs = [ + 'core.entity_view_display.node.oe_sc_event.full', + 'core.entity_view_display.node.oe_sc_event.oe_w_content_banner', + 'core.entity_view_display.node.oe_sc_event.teaser', + ]; + ConfigImporter::importMultiple('module', 'oe_whitelabel_starter_event', '/config/post_updates/00001_content_banner', $configs, TRUE); +} diff --git a/modules/oe_whitelabel_starter_news/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_news.full.yml b/modules/oe_whitelabel_starter_news/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_news.full.yml new file mode 100644 index 0000000000000000000000000000000000000000..c79b5a1c89a59a1486bf42769d054ffcb3567ddd --- /dev/null +++ b/modules/oe_whitelabel_starter_news/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_news.full.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.full + - field.field.node.oe_sc_news.body + - field.field.node.oe_sc_news.oe_featured_media + - field.field.node.oe_sc_news.oe_publication_date + - field.field.node.oe_sc_news.oe_summary + - node.type.oe_sc_news + module: + - text + - user +id: node.oe_sc_news.full +targetEntityType: node +bundle: oe_sc_news +mode: full +content: + body: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 0 + region: content + links: + settings: { } + third_party_settings: { } + weight: 1 + region: content +hidden: + langcode: true + oe_content_content_owner: true + oe_content_legacy_link: true + oe_content_navigation_title: true + oe_content_short_title: true + oe_featured_media: true + oe_publication_date: true + oe_summary: true + search_api_excerpt: true diff --git a/modules/oe_whitelabel_starter_news/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_news.oe_w_content_banner.yml b/modules/oe_whitelabel_starter_news/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_news.oe_w_content_banner.yml new file mode 100644 index 0000000000000000000000000000000000000000..2eb3b1342ba4ae932410a6408ab069618714795d --- /dev/null +++ b/modules/oe_whitelabel_starter_news/config/post_updates/00001_content_banner/core.entity_view_display.node.oe_sc_news.oe_w_content_banner.yml @@ -0,0 +1,44 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.oe_w_content_banner + - field.field.node.oe_sc_news.body + - field.field.node.oe_sc_news.oe_featured_media + - field.field.node.oe_sc_news.oe_publication_date + - field.field.node.oe_sc_news.oe_summary + - node.type.oe_sc_news + module: + - datetime + - text + - user +id: node.oe_sc_news.oe_w_content_banner +targetEntityType: node +bundle: oe_sc_news +mode: oe_w_content_banner +content: + oe_publication_date: + type: datetime_default + label: hidden + settings: + timezone_override: '' + format_type: oe_whitelabel_starter_news_date + third_party_settings: { } + weight: 1 + region: content + oe_summary: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 0 + region: content +hidden: + body: true + langcode: true + links: true + oe_content_content_owner: true + oe_content_legacy_link: true + oe_content_navigation_title: true + oe_content_short_title: true + oe_featured_media: true diff --git a/modules/oe_whitelabel_starter_news/oe_whitelabel_starter_news.info.yml b/modules/oe_whitelabel_starter_news/oe_whitelabel_starter_news.info.yml index 2a50f9cf046fb725e6ec4cf61e5f36e791510633..301d65c485cc725129a710235aaa8ad77d0cc560 100644 --- a/modules/oe_whitelabel_starter_news/oe_whitelabel_starter_news.info.yml +++ b/modules/oe_whitelabel_starter_news/oe_whitelabel_starter_news.info.yml @@ -6,7 +6,6 @@ core_version_requirement: ^9.2 dependencies: - oe_whitelabel:oe_whitelabel_helper - oe_starter_content:oe_starter_content_news - - drupal:twig_field_value config_devel: install: diff --git a/modules/oe_whitelabel_starter_news/oe_whitelabel_starter_news.post_update.php b/modules/oe_whitelabel_starter_news/oe_whitelabel_starter_news.post_update.php new file mode 100644 index 0000000000000000000000000000000000000000..4f5a135261a36792c5a28a616dfa337198a6731d --- /dev/null +++ b/modules/oe_whitelabel_starter_news/oe_whitelabel_starter_news.post_update.php @@ -0,0 +1,21 @@ +<?php + +/** + * @file + * Post update hooks. + */ + +declare(strict_types = 1); + +use Drupal\oe_bootstrap_theme\ConfigImporter; + +/** + * Move content banner into a block. + */ +function oe_whitelabel_starter_news_post_update_00001(): void { + $configs = [ + 'core.entity_view_display.node.oe_sc_news.full', + 'core.entity_view_display.node.oe_sc_news.oe_w_content_banner', + ]; + ConfigImporter::importMultiple('module', 'oe_whitelabel_starter_news', '/config/post_updates/00001_content_banner', $configs, TRUE); +} diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index 6be05efd19aac9b9da2c23fe12627f36130b6e1b..f44bc248b7971f9f8a0fa2307ac473356602f5b6 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -8,7 +8,6 @@ declare(strict_types = 1); use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; use Drupal\oe_bootstrap_theme_helper\EuropeanUnionLanguages; use Drupal\oe_whitelabel\DocumentMediaWrapper; @@ -20,36 +19,6 @@ foreach (glob($includes_path) as $filename) { require_once __DIR__ . '/includes/' . basename($filename); } -/** - * Implements hook_form_FORM_ID_alter() for facets_forms. - */ -function oe_whitelabel_form_facets_form_alter(&$form, FormStateInterface $form_state, $form_id) { - if (isset($form['actions'])) { - $action_classes = ['mt-4', 'd-grid', 'gap-4', 'd-md-block']; - foreach ($action_classes as $action_class) { - if (!isset($action_class, $form['actions']['#attributes']['class']) || !in_array($action_class, $form['actions']['#attributes']['class'], TRUE)) { - $form['actions']['#attributes']['class'][] = $action_class; - } - } - } - if (isset($form['actions']['submit'])) { - $submit_classes = ['me-md-3', 'btn', 'btn-primary', 'btn-md']; - foreach ($submit_classes as $submit_class) { - if (!isset($submit_class, $form['actions']['submit']['#attributes']['class']) || !in_array($submit_class, $form['actions']['submit']['#attributes']['class'], TRUE)) { - $form['actions']['submit']['#attributes']['class'][] = $submit_class; - } - } - } - if (isset($form['actions']['reset'])) { - $reset_classes = ['btn', 'btn-light', 'btn-md']; - foreach ($reset_classes as $reset_class) { - if (!isset($form['actions']['reset']['#attributes']['class']) || !in_array($reset_class, $form['actions']['reset']['#attributes']['class'], TRUE)) { - $form['actions']['reset']['#attributes']['class'][] = $reset_class; - } - } - } -} - /** * Implements hook_form_FORM_ID_alter(). */ @@ -110,7 +79,6 @@ function oe_whitelabel_preprocess_page(&$variables) { $variables['logo_aria_label'] = t('Home'); $variables['site_logo_alt'] = t('Home logo'); $variables['site_logo_title'] = t('Home'); - $site_logo_href = Url::fromRoute('<front>')->toString(); } if ($variables['bcl_component_library'] === 'neutral') { diff --git a/runner.yml.dist b/runner.yml.dist index 073d90cd2d01233b62608a1c128f117afd578eed..f33dffc54ae9eb351cef818fc3b4a8ab0f9994c6 100644 --- a/runner.yml.dist +++ b/runner.yml.dist @@ -18,7 +18,6 @@ drupal: - "./vendor/bin/drush en config_devel -y" - "./vendor/bin/drush en field_ui -y" - "./vendor/bin/drush en oe_authentication -y" - - "./vendor/bin/drush en oe_corporate_blocks -y" - "./vendor/bin/drush en oe_whitelabel_helper -y" - "./vendor/bin/drush en oe_whitelabel_contact_forms -y" - "./vendor/bin/drush en oe_whitelabel_multilingual -y" diff --git a/modules/oe_whitelabel_starter_event/templates/field--node--body--oe-sc-event.html.twig b/templates/content/field--node--body--oe-sc-event.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_event/templates/field--node--body--oe-sc-event.html.twig rename to templates/content/field--node--body--oe-sc-event.html.twig diff --git a/modules/oe_whitelabel_starter_event/templates/field--node--oe-documents--oe-sc-event.html.twig b/templates/content/field--node--oe-documents--oe-sc-event.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_event/templates/field--node--oe-documents--oe-sc-event.html.twig rename to templates/content/field--node--oe-documents--oe-sc-event.html.twig diff --git a/modules/oe_whitelabel_starter_news/templates/field--node--oe-publication-date--oe-sc-news.html.twig b/templates/content/field--node--oe-publication-date--oe-sc-news.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_news/templates/field--node--oe-publication-date--oe-sc-news.html.twig rename to templates/content/field--node--oe-publication-date--oe-sc-news.html.twig diff --git a/modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--full.html.twig b/templates/content/node--oe-sc-event--full.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--full.html.twig rename to templates/content/node--oe-sc-event--full.html.twig diff --git a/modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--oe-w-content-banner.html.twig b/templates/content/node--oe-sc-event--oe-w-content-banner.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--oe-w-content-banner.html.twig rename to templates/content/node--oe-sc-event--oe-w-content-banner.html.twig diff --git a/modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--teaser.html.twig b/templates/content/node--oe-sc-event--teaser.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--teaser.html.twig rename to templates/content/node--oe-sc-event--teaser.html.twig diff --git a/modules/oe_whitelabel_starter_news/templates/node--oe-sc-news--full.html.twig b/templates/content/node--oe-sc-news--full.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_news/templates/node--oe-sc-news--full.html.twig rename to templates/content/node--oe-sc-news--full.html.twig diff --git a/modules/oe_whitelabel_starter_news/templates/node--oe-sc-news--oe-w-content-banner.html.twig b/templates/content/node--oe-sc-news--oe-w-content-banner.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_news/templates/node--oe-sc-news--oe-w-content-banner.html.twig rename to templates/content/node--oe-sc-news--oe-w-content-banner.html.twig diff --git a/modules/oe_whitelabel_starter_news/templates/node--oe-sc-news--teaser.html.twig b/templates/content/node--oe-sc-news--teaser.html.twig similarity index 100% rename from modules/oe_whitelabel_starter_news/templates/node--oe-sc-news--teaser.html.twig rename to templates/content/node--oe-sc-news--teaser.html.twig diff --git a/templates/list_pages/item-list--oe-list-pages-results.html.twig b/templates/list_pages/item-list--oe-list-pages-results.html.twig index 8acea4bf0a9676524abf399c7e1d7e3acdacde10..a18164bf778d01e69ad5a5c15cf424eb84d4e77c 100644 --- a/templates/list_pages/item-list--oe-list-pages-results.html.twig +++ b/templates/list_pages/item-list--oe-list-pages-results.html.twig @@ -31,4 +31,3 @@ {%- endif -%} </div> </div> -<hr class="d-none d-md-block mt-4-5"> diff --git a/templates/overrides/navigation/pager.html.twig b/templates/overrides/navigation/pager.html.twig new file mode 100755 index 0000000000000000000000000000000000000000..29f8f9bcdfa1613325435d8368ac504bdfa4f0e9 --- /dev/null +++ b/templates/overrides/navigation/pager.html.twig @@ -0,0 +1,11 @@ +{# +/** + * @file + * Override for oe_bootstrap_theme 'pager' template. + */ +#} +{% extends "@oe_bootstrap_theme/overrides/navigation/pager.html.twig" %} +{% block pager %} + <hr class="d-none d-md-block mt-4-5"> + {{ parent()}} +{% endblock %} diff --git a/templates/overrides/page/page.html.twig b/templates/overrides/page/page.html.twig index cd47a91a9449b51877ab39e0144a869984a2439f..a6f0c6e8572d5833f83c1e70f4b8e16d5876df3a 100644 --- a/templates/overrides/page/page.html.twig +++ b/templates/overrides/page/page.html.twig @@ -47,12 +47,13 @@ * @ingroup themeable */ #} +{% set neutral = bcl_component_library == 'neutral' %} {% set corporate_logos %} - {% set anchor_attributes = bcl_component_library == 'neutral' + {% set anchor_attributes = neutral ? create_attribute().addClass(['navbar-brand']) : create_attribute().addClass(['navbar-brand']).setAttribute('target', '_blank') %} - <a {{ anchor_attributes }} href="{{ site_logo_href }}"> + <a {{ anchor_attributes }} href="{{ neutral ? front_page : site_logo_href }}"> {% if bcl_component_library == 'eu' %} <picture> <source media="(max-width: 992px)" @@ -115,18 +116,18 @@ {% endif %} {% if page.sidebar_left %} - <div class="col-md-3"> + <div class="col-12 col-lg-3"> {{ page.sidebar_left }} </div> {% endif %} {% if page.content or page.content_top %} - <div class="col-12 {{ page.sidebar_left ? 'col-lg-9' }}"> + <div class="col-12 {{ page.sidebar_left ? 'col-lg-9 col-xxl-8' }}"> {% if page.content_top %} - <div class="mb-3 clearfix"> + <div class="row"> {{ page.content_top }} </div> - <hr class="d-none d-md-block mt-4 mb-4-75"> + <hr class="d-none d-md-block mb-4-75"> {% endif %} {{ page.content }} diff --git a/templates/overrides/search/block--facets-form.html.twig b/templates/overrides/search/block--facets-form.html.twig index 3729c6255aff361caa5880102f6b798c1feb8004..e9028b594e4602ecfbdb3414197fe25d652462ed 100644 --- a/templates/overrides/search/block--facets-form.html.twig +++ b/templates/overrides/search/block--facets-form.html.twig @@ -1,32 +1,9 @@ {# /** * @file - * Default theme implementation to display a block. + * Theme block implementation to display facet form. * - * Available variables: - * - plugin_id: The ID of the block implementation. - * - label: The configured label of the block if visible. - * - configuration: A list of the block's configuration values. - * - label: The configured label for the block. - * - label_display: The display settings for the label. - * - provider: The module or other provider that provided this block plugin. - * - Block plugin specific settings will also be stored here. - * - content: The content of this block. - * - attributes: array of HTML attributes populated by modules, intended to - * be added to the main container tag of this template. - * - id: A valid HTML ID and guaranteed unique. - * - title_attributes: Same as attributes, except applied to the main title - * tag that appears in the template. - * - content_attributes: Same as attributes, except applied to the main content - * tag that appears in the template. - * - title_prefix: Additional output populated by modules, intended to be - * displayed in front of the main title tag that appears in the template. - * - title_suffix: Additional output populated by modules, intended to be - * displayed after the main title tag that appears in the template. - * - * @see template_preprocess_block() - * - * @ingroup themeable + * @see ./core/themes/stable/templates/block/block.html.twig */ #} diff --git a/templates/overrides/search/block--facets-summary-block.html.twig b/templates/overrides/search/block--facets-summary-block.html.twig index 52fd4812e42db86d2c166e204e29db54047535be..d777df73c277dd4a862927a372f52930823996a0 100644 --- a/templates/overrides/search/block--facets-summary-block.html.twig +++ b/templates/overrides/search/block--facets-summary-block.html.twig @@ -1,46 +1,25 @@ {# /** * @file - * Default theme implementation to display a block. + * Theme block implementation to display facets summary. * - * Available variables: - * - plugin_id: The ID of the block implementation. - * - label: The configured label of the block if visible. - * - configuration: A list of the block's configuration values. - * - label: The configured label for the block. - * - label_display: The display settings for the label. - * - provider: The module or other provider that provided this block plugin. - * - Block plugin specific settings will also be stored here. - * - content: The content of this block. - * - attributes: array of HTML attributes populated by modules, intended to - * be added to the main container tag of this template. - * - id: A valid HTML ID and guaranteed unique. - * - title_attributes: Same as attributes, except applied to the main title - * tag that appears in the template. - * - title_prefix: Additional output populated by modules, intended to be - * displayed in front of the main title tag that appears in the template. - * - title_suffix: Additional output populated by modules, intended to be - * displayed after the main title tag that appears in the template. - * - * @see template_preprocess_block() - * - * @ingroup themeable + * @see ./core/themes/stable/templates/block/block.html.twig */ #} {% if label and content['#items'][0]['#theme'] is defined and content['#items'][0]['#theme'] == 'facets_summary_count' %} {% set results_count = content['#items'][0] %} - {% set content = content['#items']|slice(1) %} {% endif %} {% block content %} {% spaceless %} {{ title_prefix }} {% if label %} - <h4 class="mb-4"> - {{ label }} - {{ results_count }} - </h4> + <div class="col-md-6 col-lg-8 align-self-center"> + <h4 class="mb-0"><span class="text-capitalize">{{ label }} </span> {{ results_count }}</h4> + </div> {% endif %} {{ title_suffix }} - {{ content }} + <div class="col-md-12 order-md-2 mt-3"> + {{ content }} + </div> {% endspaceless %} {% endblock %} diff --git a/templates/overrides/search/facets-summary-item-list.html.twig b/templates/overrides/search/facets-summary-item-list.html.twig index 3419f8be106151669a00dd7015e34a0cf74b6338..96c61e9ce2617ce2562e5b2db941a5c6262869b3 100755 --- a/templates/overrides/search/facets-summary-item-list.html.twig +++ b/templates/overrides/search/facets-summary-item-list.html.twig @@ -1,24 +1,10 @@ {# /** * @file - * Default theme implementation for a facets summary item list. + * Theme implementation for a facets summary item list in oe_whitelabel. * - * Available variables: - * - items: A list of items. Each item contains: - * - attributes: HTML attributes to be applied to each list item. - * - value: The content of the list element. - * - title: The title of the list. - * - list_type: The tag for list element ("ul" or "ol"). - * - wrapper_attributes: HTML attributes to be applied to the list wrapper. - * - attributes: HTML attributes to be applied to the list. - * - empty: A message to display when there are no items. Allowed value is a - * string or render array. - * - context: A list of contextual data associated with the list. May contain: - * - list_style: The custom list style. + * @see ./modules/contrib/facets/modules/facets_summary/templates/facets-summary-item-list.html * - * @see facets_summary_preprocess_facets_summary_item_list() - * - * @ingroup themeable */ #} {%- if items -%} diff --git a/tests/src/Kernel/SiteBrandingBlockTest.php b/tests/src/Kernel/SiteBrandingBlockTest.php index aadf149deacbbcddfb650cb69de1ae479b47aac2..7ff0346479450aee0bb7a9cc4c641b8d1737f3eb 100644 --- a/tests/src/Kernel/SiteBrandingBlockTest.php +++ b/tests/src/Kernel/SiteBrandingBlockTest.php @@ -4,6 +4,7 @@ declare(strict_types = 1); namespace Drupal\Tests\oe_whitelabel\Kernel; +use Drupal\Core\Url; use Drupal\KernelTests\KernelTestBase; use Symfony\Component\DomCrawler\Crawler; @@ -71,6 +72,7 @@ class SiteBrandingBlockTest extends KernelTestBase { $link = $actual->filter('.text-decoration-none.align-bottom'); $this->assertCount(1, $link); $actual = $crawler->filter('.site-logo.d-none.d-lg-inline-block'); + $this->assertSame(Url::fromRoute('<front>')->toString(), $actual->attr('href')); $this->assertCount(1, $actual); $logo = $actual->filter('img'); $this->assertCount(1, $logo); @@ -93,6 +95,7 @@ class SiteBrandingBlockTest extends KernelTestBase { $link = $actual->filter('.text-decoration-none.align-bottom'); $this->assertCount(1, $link); $actual = $crawler->filter('.site-logo.d-none.d-lg-inline-block'); + $this->assertSame(Url::fromRoute('<front>')->toString(), $actual->attr('href')); $this->assertCount(1, $actual); $logo = $actual->filter('img'); $this->assertCount(1, $logo); @@ -112,6 +115,7 @@ class SiteBrandingBlockTest extends KernelTestBase { $actual = $crawler->filter('.bcl-header__site-name.site-name.h5.d-inline-block.d-lg-none'); $this->assertCount(1, $actual); $link = $actual->filter('.text-decoration-none.align-bottom'); + $this->assertSame(Url::fromRoute('<front>')->toString(), $link->attr('href')); $this->assertCount(1, $link); }