From ce00e4a4bad3414df1533646b13bf198b93b1f44 Mon Sep 17 00:00:00 2001 From: Matt Poole Date: Thu, 17 Oct 2024 15:54:45 -0400 Subject: [PATCH] BSD fixes #312: Add case study path auto since it is ignored. --- .../custom/case_studies/case_studies.install | 18 ++++++++++++++++ .../install/pathauto.pattern.case_studies.yml | 21 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 web/modules/custom/case_studies/config/install/pathauto.pattern.case_studies.yml diff --git a/web/modules/custom/case_studies/case_studies.install b/web/modules/custom/case_studies/case_studies.install index ab363bc2..70e45a4a 100644 --- a/web/modules/custom/case_studies/case_studies.install +++ b/web/modules/custom/case_studies/case_studies.install @@ -5,6 +5,8 @@ * Install, update and uninstall functions for the Case Studies module. */ +use Drupal\Core\Config\FileStorage; + /** * Implements hook_install(). */ @@ -46,3 +48,19 @@ function _case_studies_add_case_study_xmlsitemap_entries() { ]); } } + +/** + * Implements hook_update_n(). + * + * Add path alias settings for case studies. + */ +function case_studies_update_8002($is_syncing) { + // Get all configs in the config install dir and install them. + $source = new FileStorage(__DIR__ . '/config/install'); + $config_storage = \Drupal::service('config.storage'); + foreach ($source->listAll() as $config_name) { + $config_storage->write($config_name, $source->read($config_name)); + \Drupal::logger('case_studies')->info('Configuration for @config_name was successfully imported as text.', ['@config_name' => $config_name]); + } + +} \ No newline at end of file diff --git a/web/modules/custom/case_studies/config/install/pathauto.pattern.case_studies.yml b/web/modules/custom/case_studies/config/install/pathauto.pattern.case_studies.yml new file mode 100644 index 00000000..e5bc85dc --- /dev/null +++ b/web/modules/custom/case_studies/config/install/pathauto.pattern.case_studies.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + module: + - node +id: case_studies +label: 'Case Studies' +type: 'canonical_entities:node' +pattern: 'our-work/[node:title]' +selection_criteria: + c5da88d6-f0e4-4202-ba8d-c0c5c6ff8a6b: + id: 'entity_bundle:node' + negate: false + uuid: c5da88d6-f0e4-4202-ba8d-c0c5c6ff8a6b + context_mapping: + node: node + bundles: + case_study: case_study +selection_logic: and +weight: -5 +relationships: { } \ No newline at end of file