diff --git a/README.md b/README.md index 2e4d9eb64..32cceda49 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ > For support, see [Getting help](https://docs.civictheme.io/getting-help) documentation > [!IMPORTANT] -> For Drupal theme installation instructions into your site, see https://docs.civictheme.io/development/drupal-theme +> For Drupal theme installation instructions, see https://docs.civictheme.io/development/drupal-theme ## Monorepo documentation diff --git a/tests/behat/features/paragraph.civictheme_automated_list.render.feature b/tests/behat/features/paragraph.civictheme_automated_list.render.feature index c00f7a183..228f184e1 100644 --- a/tests/behat/features/paragraph.civictheme_automated_list.render.feature +++ b/tests/behat/features/paragraph.civictheme_automated_list.render.feature @@ -238,9 +238,11 @@ Feature: Automated list render @api @testmode Scenario: Automated list, different view from listing type field Given "civictheme_page" content: - | title | created | status | moderation_state | - | [TEST] Page 16 | [relative:-5 days] | 1 | published | - | [TEST] Page 17 | [relative:-5 days] | 1 | published | + | title | created | status | moderation_state | field_c_n_vertical_spacing | + | [TEST] Page 16 | [relative:-5 days] | 1 | published | both | + | [TEST] Page 17 | [relative:-5 days] | 1 | published | both | + | [TEST] Page 18 | [relative:-5 days] | 1 | published | top | + | [TEST] Page 19 | [relative:-5 days] | 1 | published | top | And "field_c_n_components" in "civictheme_page" "node" with "title" of "Test page with Automated list content" has "civictheme_automated_list" paragraph: | field_c_p_title | [TEST] Automated list title | @@ -260,7 +262,9 @@ Feature: Automated list render And I should see an ".ct-list__filters" element # Add a Test view as a list type. - # This view only shows items older than 2 days and has a Title filter exposed. + # This view only shows items older than 2 days, having a 'top' vertical + # spacing (to assert the adjustems via preprocess hook) and has a Title + # filter exposed. When I am logged in as a user with the "Administrator" role And I go to "admin/structure/paragraphs_type/civictheme_automated_list/fields/paragraph.civictheme_automated_list.field_c_p_list_type" And I fill in the following: @@ -277,7 +281,8 @@ Feature: Automated list render And I press "Save" And I should see 2 ".ct-promo-card" elements - And I should see 2 ".ct-promo-card.ct-theme-light" elements + # Preprocess hook overrides the 'item_theme' to be 'dark'. + And I should see 2 ".ct-promo-card.ct-theme-dark" elements And I should not see an ".ct-list__pagination" element And I should see an ".ct-list__filters" element diff --git a/tests/phpunit/CivicthemeCreateSubthemeScriptUnitTest.php b/tests/phpunit/CivicthemeCreateSubthemeScriptUnitTest.php index 6a9ab0895..2257345ea 100644 --- a/tests/phpunit/CivicthemeCreateSubthemeScriptUnitTest.php +++ b/tests/phpunit/CivicthemeCreateSubthemeScriptUnitTest.php @@ -130,7 +130,6 @@ public function testLocation(string $civictheme_dir, string $newtheme_rel_dir, s $this->assertFileExists($expected_new_theme_dir_full . '.stylelintrc.json'); $this->assertFileExists($expected_new_theme_dir_full . $newtheme_name . '.info.yml'); $this->assertFileExists($expected_new_theme_dir_full . $newtheme_name . '.libraries.yml'); - $this->assertFileExists($expected_new_theme_dir_full . $newtheme_name . '.theme'); $this->assertFileExists($expected_new_theme_dir_full . 'gulpfile.js'); $this->assertFileExists($expected_new_theme_dir_full . 'composer.json'); $this->assertFileExists($expected_new_theme_dir_full . 'package.json'); @@ -246,7 +245,6 @@ public function testExamplesRemoval(): void { $this->assertFileExists($expected_new_theme_dir_full . '.stylelintrc.json'); $this->assertFileExists($expected_new_theme_dir_full . $newtheme_name . '.info.yml'); $this->assertFileExists($expected_new_theme_dir_full . $newtheme_name . '.libraries.yml'); - $this->assertFileExists($expected_new_theme_dir_full . $newtheme_name . '.theme'); $this->assertFileExists($expected_new_theme_dir_full . 'gulpfile.js'); $this->assertFileExists($expected_new_theme_dir_full . 'package.json'); $this->assertFileExists($expected_new_theme_dir_full . 'README.md'); diff --git a/web/modules/custom/civictheme_dev/civictheme_dev.module b/web/modules/custom/civictheme_dev/civictheme_dev.module index 242ad3ca4..95a30f7cd 100644 --- a/web/modules/custom/civictheme_dev/civictheme_dev.module +++ b/web/modules/custom/civictheme_dev/civictheme_dev.module @@ -7,8 +7,10 @@ declare(strict_types=1); +use Drupal\civictheme\CivicthemeConstants; use Drupal\civictheme\CivicthemeVersionManager; use Drupal\Core\Site\Settings; +use Drupal\views\ViewExecutable; require_once __DIR__ . '/styleguide.inc'; @@ -48,3 +50,44 @@ function civictheme_dev_styleguide_alter(array &$items): void { _civictheme_dev_styleguide__form_test__checkboxes($items); _civictheme_dev_styleguide__form_test__radios($items); } + +/** + * Implements hook_civictheme_automated_list_view_info_alter(). + */ +function civictheme_dev_civictheme_automated_list_view_info_alter(array &$info, array $settings): void { + if ($settings['content_type'] == 'civictheme_event') { + // Use a different view and display for 'civictheme_event' content type. + $info['view_name'] = 'civictheme_automated_list_examples'; + $info['display_name'] = 'page_multiple_filters'; + } +} + +/** + * Implements hook_civictheme_automated_list_view_alter(). + */ +function civictheme_dev_civictheme_automated_list_view_alter(ViewExecutable $view): void { + if ($view->id() === 'civictheme_automated_list_test') { + if (!property_exists($view, 'component_settings') || $view->component_settings === NULL) { + return; + } + + $view->component_settings['theme'] = CivicthemeConstants::THEME_LIGHT; + $view->component_settings['item_theme'] = CivicthemeConstants::THEME_DARK; + + // Example of setting view arguments based on the expected contextual + // filters of this specific view. + $view_args = []; + // First view argument - content types. + $view_args[] = $view->component_settings['content_type'] ?? 'all'; + // Second view argument - Topics. + $view_args[] = empty($view->component_settings['topics']) ? 'all' : implode('+', array_keys($view->component_settings['topics'])); + // Third view argument - Site Sections. + $view_args[] = empty($view->component_settings['site_sections']) ? 'all' : implode('+', array_keys($view->component_settings['site_sections'])); + // Fourth view argument - Content ID value. + $view_args[] = 'all'; + // Fifth view argument - Vertical Spacing value (used as an example). + $view_args[] = CivicthemeConstants::VERTICAL_SPACING_TOP; + + $view->setArguments($view_args); + } +} diff --git a/web/modules/custom/civictheme_dev/config/install/views.view.civictheme_automated_list_test.yml b/web/modules/custom/civictheme_dev/config/install/views.view.civictheme_automated_list_test.yml index 168e65dfa..4ed3d58c9 100644 --- a/web/modules/custom/civictheme_dev/config/install/views.view.civictheme_automated_list_test.yml +++ b/web/modules/custom/civictheme_dev/config/install/views.view.civictheme_automated_list_test.yml @@ -7,6 +7,7 @@ dependencies: - taxonomy.vocabulary.civictheme_topics module: - node + - options - taxonomy - user id: civictheme_automated_list_test @@ -300,6 +301,45 @@ display: validate_options: { } break_phrase: false not: true + field_c_n_vertical_spacing_value: + id: field_c_n_vertical_spacing_value + table: node__field_c_n_vertical_spacing + field: field_c_n_vertical_spacing_value + relationship: none + group_type: group + admin_label: '' + plugin_id: string_list_field + default_action: ignore + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: fixed + default_argument_options: + argument: '' + summary_options: + base_path: '' + count: true + override: false + items_per_page: 25 + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + human: false + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + glossary: false + limit: 0 + case: none + path_case: none + transform_dash: false + break_phrase: false filters: status: id: status @@ -572,7 +612,6 @@ display: - 'languages:language_interface' - url - url.query_args - - user - 'user.node_grants:view' - user.permissions tags: { } @@ -595,7 +634,6 @@ display: - 'languages:language_interface' - url - url.query_args - - user - 'user.node_grants:view' - user.permissions tags: { } diff --git a/web/themes/contrib/civictheme/README.md b/web/themes/contrib/civictheme/README.md index a3fcf35f8..345ba8f27 100644 --- a/web/themes/contrib/civictheme/README.md +++ b/web/themes/contrib/civictheme/README.md @@ -17,9 +17,8 @@ The Drupal theme provides full integration and ships with the UI Kit. ## Installation -```bash -composer require drupal/civictheme -``` +> [!IMPORTANT] +> For Drupal theme installation instructions, see https://docs.civictheme.io/development/drupal-theme Enable CivicTheme theme to use it as-is - CivicTheme UI kit is already included as a set of compiled assets. diff --git a/web/themes/contrib/civictheme/civictheme.api.php b/web/themes/contrib/civictheme/civictheme.api.php index d9efffed9..4449183d8 100644 --- a/web/themes/contrib/civictheme/civictheme.api.php +++ b/web/themes/contrib/civictheme/civictheme.api.php @@ -12,14 +12,23 @@ use Drupal\views\ViewExecutable; /** - * Alter the view info used in the Automated list component. + * Alter the info about the view used in the Automated list component. + * + * This hook allows to alter which view and display are used to power the + * Automated list component based on the settings provided. + * The settings are extracted from the fields provided by the CivicTheme within + * the Automated list paragraph entity. + * Note that for any custom fields added to the Automated list paragraph entity, + * the settings would need to be extracted from those fields using + * $settings['paragraph']->get('field_name')->getString() or similar methods as + * CivicTheme cannot predict the field names used in the custom implementation. * * @param array $info * View info array to alter passed by reference. Keys are: * - view_name: (string) A view machine name. * - display_name: (string) A view display machine name. * @param array $settings - * The Automated list component settings passed by reference with the + * The Automated list component settings with the * following keys: * - title: (string) List title. * - type: (string) List type (view name that powers Automated list). @@ -33,8 +42,9 @@ * - topics: (array) Array of Topic entities. * - site_sections: (array) Array of Site section entities. * - cache_tags: (array) Array of the cache tags. + * - paragraph: (Paragraph) The paragraph entity. */ -function hook_civictheme_automated_list_view_info_alter(array &$info, array &$settings): void { +function hook_civictheme_automated_list_view_info_alter(array &$info, array $settings): void { // Change the view name and block based on the conditions set in the // Automated list settings. if ($settings['content_type'] == 'event') { @@ -49,48 +59,65 @@ function hook_civictheme_automated_list_view_info_alter(array &$info, array &$se } /** - * Alter the CivicTheme view preprocess settings. + * Alter the view used in the Automated list component before rendering. * - * @param array $variables - * Array of preprocess variables of the Automated list view. + * The view instance already has settings applied from the default fields + * provided by the CivicTheme within the Automated list paragraph entity. + * Any additional settings can be extracted from the fields provided by the + * Automated list paragraph entity using $view->component_settings['paragraph']. + * + * @param \Drupal\views\ViewExecutable $view + * The view object to alter. */ -function hook_civictheme_automated_list_preprocess_view_alter(array &$variables, ViewExecutable &$view): void { - if ($view->id() == 'civictheme_view_examples') { - $variables['theme'] = CivicthemeConstants::THEME_DARK; - $variables['with_background'] = TRUE; - $variables['vertical_spacing'] = 'both'; +function hook_civictheme_automated_list_view_alter(ViewExecutable $view): void { + // Example of altering the view theme, item theme and arguments. + if ($view->id() === 'custom_view_id') { + $view->component_settings['theme'] = CivicthemeConstants::THEME_LIGHT; + $view->component_settings['item_theme'] = CivicthemeConstants::THEME_DARK; + + // Example of setting view arguments based on the expected contextual + // filters of this specific view. + // In thi example, the view has 3 contextual filters. + $view_args = []; + // First view argument - content types. Read from settings. + $view_args[] = $view->component_settings['content_type'] ?? 'all'; + // Second view argument - Content ID value. Use `all` to skip it. + $view_args[] = 'all'; + // Third view argument - Vertical Spacing value. Use a constant value. + $view_args[] = CivicthemeConstants::VERTICAL_SPACING_TOP; + // Set the arguments to the view. + $view->setArguments($view_args); } +} - /** - * Allow to suppress page regions for pages with Layout Builder enabled. - * - * @param array $variables - * Array of variables passed to the page template. - * @param array $context - * Array of context data. - * - node: The node object. - * - layout_builder_settings_per_view_mode: An array of the layout builder - * settings keyed by view mode. - * - * @SuppressWarnings(PHPMD.StaticAccess) - */ - function hook_civictheme_layout_suppress_page_regions_alter(array &$variables, array $context): void { - /** @var \Drupal\node\NodeInterface $node */ - $node = $variables['node']; - if ($node->bundle() == 'civictheme_page' && $context['layout_builder_settings_per_view_mode']['full']['enabled']) { - $variables['page']['sidebar_top_left'] = []; - $variables['page']['sidebar_bottom_left'] = []; - $variables['page']['sidebar_top_right'] = []; - $variables['page']['sidebar_bottom_right'] = []; +/** + * Allow to suppress page regions for pages with Layout Builder enabled. + * + * @param array $variables + * Array of variables passed to the page template. + * @param array $context + * Array of context data. + * - node: The node object. + * - layout_builder_settings_per_view_mode: An array of the layout builder + * settings keyed by view mode. + * + * @SuppressWarnings(PHPMD.StaticAccess) + */ +function hook_civictheme_layout_suppress_page_regions_alter(array &$variables, array $context): void { + /** @var \Drupal\node\NodeInterface $node */ + $node = $variables['node']; + if ($node->bundle() == 'civictheme_page' && $context['layout_builder_settings_per_view_mode']['full']['enabled']) { + $variables['page']['sidebar_top_left'] = []; + $variables['page']['sidebar_bottom_left'] = []; + $variables['page']['sidebar_top_right'] = []; + $variables['page']['sidebar_bottom_right'] = []; - // Do not forget to merge the cache contexts. - $variables['#cache']['contexts'] = Cache::mergeContexts( - $variables['#cache']['contexts'] ?? [], - [ - 'user.roles:authenticated', - ] - ); - } + // Do not forget to merge the cache contexts. + $variables['#cache']['contexts'] = Cache::mergeContexts( + $variables['#cache']['contexts'] ?? [], + [ + 'user.roles:authenticated', + ] + ); } - } diff --git a/web/themes/contrib/civictheme/civictheme.post_update.php b/web/themes/contrib/civictheme/civictheme.post_update.php index 39722ba64..8edbb31f6 100644 --- a/web/themes/contrib/civictheme/civictheme.post_update.php +++ b/web/themes/contrib/civictheme/civictheme.post_update.php @@ -12,6 +12,8 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\Core\Utility\UpdateException; +use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay; use Drupal\node\Entity\Node; use Drupal\paragraphs\ParagraphInterface; @@ -528,6 +530,7 @@ static function (CivicthemeUpdateHelper $helper, EntityInterface $entity): bool // Finished callback. static function (CivicthemeUpdateHelper $helper) use ($old_field_configs): TranslatableMarkup { $helper->deleteConfig($old_field_configs); + return new TranslatableMarkup("Updated quote component to a content component.\n"); }, ); @@ -619,3 +622,140 @@ function civictheme_post_update_enable_focal_point_configurations_2(): void { ]; \Drupal::classResolver(CivicthemeUpdateHelper::class)->deleteConfig($old_field_configs); } + +/** + * Moves blocks from 'sidebar' to 'sidebar_top_left' region. + * + * @SuppressWarnings(PHPMD.StaticAccess) + */ +function civictheme_post_update_move_blocks_to_sidebar_top_left(): string { + $region_from = 'sidebar'; + $region_to = 'sidebar_top_left'; + + /** @var \Drupal\Core\Theme\ActiveTheme $theme */ + $theme = \Drupal::service('theme.manager')->getActiveTheme(); + + if (!in_array('civictheme', $theme->getBaseThemeExtensions()) && $theme->getName() !== 'civictheme') { + return (string)(new TranslatableMarkup('The active theme is not CivicTheme or based on CivicTheme. No blocks were moved.')); + } + + // Stop the update if the theme does not have a region that needs to be added + // manually to the .info.yml file. + if (in_array($region_to, $theme->getRegions())) { + throw new UpdateException((string) (new TranslatableMarkup("The @theme_name theme does not have a @region region defined in their .info.yml file. Update the file and re-run the updates.", [ + '@theme_name' => $theme->getName(), + '@region' => $region_to, + ]))); + } + + /** @var \Drupal\block\BlockInterface[] $blocks */ + $blocks = \Drupal::entityTypeManager() + ->getStorage('block') + ->loadByProperties([ + 'theme' => $theme->getName(), + 'region' => $region_from, + ]); + + $updated_block_ids = []; + foreach ($blocks as $block) { + $block->setRegion($region_to); + $block->save(); + $updated_block_ids[] = $block->id(); + } + + if (!empty($updated_block_ids)) { + return (string) (new TranslatableMarkup('Theme @theme_name block(s) @blocks_ids were moved from @region_from to @region_to.', [ + '@theme_name' => $theme->getName(), + '@blocks_ids' => implode(', ', $updated_block_ids), + '@region_from' => $region_from, + '@region_to' => $region_to, + ])); + } + + return (string) (new TranslatableMarkup('No blocks were moved.')); +} + +/** + * Enables "civictheme_three_columns" layout for the Page/Event content type. + * + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.StaticAccess) + */ +function civictheme_post_update_enable_three_column_layout(): string { + $outdated_layouts = [ + 'civictheme_one_column', + 'civictheme_one_column_contained', + ]; + + $messages = []; + + $entity_displays = LayoutBuilderEntityViewDisplay::loadMultiple(); + + $updated_entity_displays = []; + foreach ($entity_displays as $entity_display) { + if (!$entity_display->isLayoutBuilderEnabled()) { + continue; + } + + // Updated 'allowed layouts' settings. + $entity_view_mode_restriction = $entity_display->getThirdPartySetting('layout_builder_restrictions', 'entity_view_mode_restriction'); + if (!empty($entity_view_mode_restriction['allowed_layouts'])) { + $allowed_layouts = $entity_view_mode_restriction['allowed_layouts']; + + foreach ($allowed_layouts as $layout_name) { + if (in_array($layout_name, $outdated_layouts)) { + unset($allowed_layouts[$layout_name]); + } + } + + if (count($entity_view_mode_restriction['allowed_layouts']) != count($allowed_layouts)) { + $allowed_layouts[] = 'civictheme_three_columns'; + + $entity_view_mode_restriction['allowed_layouts'] = array_values($allowed_layouts); + $entity_display->setThirdPartySetting('layout_builder_restrictions', 'entity_view_mode_restriction', $entity_view_mode_restriction); + + $updated_entity_displays[$entity_display->id()] = $entity_display->id(); + } + } + + // Replace layouts in sections. + /** @var \Drupal\layout_builder\Section[] $layout_builder_sections */ + $layout_builder_sections = $entity_display->getThirdPartySetting('layout_builder', 'sections'); + if (!empty($layout_builder_sections)) { + foreach ($layout_builder_sections as $index => $section) { + $layout_name = $section->getLayoutId(); + + if (in_array($layout_name, $outdated_layouts)) { + $section_as_array = $section->toArray(); + + $section_as_array['layout_id'] = 'civictheme_three_columns'; + $section_as_array['layout_settings']['label'] = 'CivicTheme Three Columns'; + $section_as_array['layout_settings']['is_contained'] = ($layout_name === 'civictheme_one_column_contained'); + + // Move all components to 'main' region because three column use + // 'main' region, not 'content' region as one column. + foreach ($section_as_array['components'] as &$component) { + if ($component['region'] === 'content') { + $component['region'] = 'main'; + } + } + + $layout_builder_sections[$index] = \Drupal\layout_builder\Section::fromArray($section_as_array); + + $updated_entity_displays[$entity_display->id()] = $entity_display->id(); + } + } + + $entity_display->setThirdPartySetting('layout_builder', 'sections', $layout_builder_sections); + } + + if (in_array($entity_display->id(), $updated_entity_displays)) { + $entity_display->save(); + $messages[] = (string) (new TranslatableMarkup('Updated @display_id display to use the "civictheme_three_columns" layout.', [ + '@display_id' => $entity_display->id(), + ])); + } + } + + return implode("\n", $messages); +} diff --git a/web/themes/contrib/civictheme/civictheme_starter_kit/civictheme_starter_kit.theme b/web/themes/contrib/civictheme/civictheme_starter_kit/civictheme_starter_kit.theme deleted file mode 100644 index 6efb3b968..000000000 --- a/web/themes/contrib/civictheme/civictheme_starter_kit/civictheme_starter_kit.theme +++ /dev/null @@ -1,34 +0,0 @@ -id() === 'civictheme_automated_list_examples' && $view->getDisplay()->display['id'] === 'civictheme_automated_list_page') { - $settings['title'] = ''; - $settings['theme'] = 'light'; - $settings['card_theme'] = 'dark'; - $settings['with_background'] = TRUE; - $settings['vertical_spacing'] = 'bottom'; - } -} - -/** - * Implements hook_civictheme_automated_list_preprocess_view_alter(). - */ -function civictheme_starter_kit_civictheme_automated_list_view_name_alter(string &$view_name, string &$display_id, Paragraph $paragraph): void { - // This is an example. - if ($paragraph->hasField('field_c_p_content_type') && !$paragraph->get('field_c_p_content_type')->isEmpty() && $paragraph->get('field_c_p_content_type')->getString() == 'civictheme_event') { - [$view_name, $display_id] = explode('__', 'civictheme_automated_list_examples__block1'); - } -} diff --git a/web/themes/contrib/civictheme/includes/automated_list.inc b/web/themes/contrib/civictheme/includes/automated_list.inc index f25af32d7..64c665acb 100644 --- a/web/themes/contrib/civictheme/includes/automated_list.inc +++ b/web/themes/contrib/civictheme/includes/automated_list.inc @@ -39,11 +39,19 @@ function civictheme_preprocess_paragraph__civictheme_automated_list(array &$vari _civictheme_preprocess_paragraph__paragraph_field__background($variables); // Views settings. - // We want to have a single place to gather all the view settings to pass + // We want to have a single place to gather all initial view settings to pass // them further in the pipeline. There should not be any other places to // access these fields variables directly (separation of concerns). Only // these settings should be used. + // Consumer sites can alter these settings in + // hook_civictheme_automated_list_view_alter(). $settings = []; + // Store paragraph entity in the settings to allow accessing the values of + // fields that may be added in the consumer sites (in addition to the fields + // provided by the CivicTheme Automated List paragraph). + $settings['paragraph'] = $paragraph; + $settings['cache_tags'] = $paragraph->getCacheTags(); + // Settings provided by the CivicTheme Automated List paragraph's fields. $settings['type'] = civictheme_get_field_value($paragraph, 'field_c_p_list_type'); $settings['content_type'] = civictheme_get_field_value($paragraph, 'field_c_p_list_content_type'); $settings['limit'] = civictheme_get_field_value($paragraph, 'field_c_p_list_limit'); @@ -53,14 +61,10 @@ function civictheme_preprocess_paragraph__civictheme_automated_list(array &$vari $settings['item_theme'] = civictheme_get_field_value($paragraph, 'field_c_p_list_item_theme'); $settings['topics'] = civictheme_get_field_value($paragraph, 'field_c_p_list_topics'); $settings['site_sections'] = civictheme_get_field_value($paragraph, 'field_c_p_list_site_sections'); - $settings['cache_tags'] = $paragraph->getCacheTags(); - // Use existing value getters to populate settings. - $settings['paragraph'] = $paragraph; _civictheme_preprocess_paragraph__paragraph_field__theme($settings); _civictheme_preprocess_paragraph__paragraph_field__title($settings); _civictheme_preprocess_paragraph__paragraph_field__column_count($settings); _civictheme_preprocess_paragraph__paragraph_field__fill_width($settings); - unset($settings['paragraph']); // Get view with already set display. try { @@ -128,7 +132,7 @@ function _civictheme_automated_list__get_view(array &$settings): ViewExecutable 'display_name' => $parts[1] ?? 'default', ]; - // Allow to alter view information to modules and themes. + // Allow modules and themes to alter view information. \Drupal::moduleHandler()->alter('civictheme_automated_list_view_info', $info, $settings); \Drupal::service('theme.manager')->alter('civictheme_automated_list_view_info', $info, $settings); } @@ -252,6 +256,10 @@ function _civictheme_automated_list__update_view(ViewExecutable $view): void { } } + // Allow modules and themes to alter view based on settings. + \Drupal::moduleHandler()->alter('civictheme_automated_list_view', $view); + \Drupal::service('theme.manager')->alter('civictheme_automated_list_view', $view); + // Mark these settings. $view->component_settings['processed'] = TRUE; }