diff --git a/modules/tide_landing_page/tide_landing_page.install b/modules/tide_landing_page/tide_landing_page.install index cc5ffe1c1..c14cd58f6 100644 --- a/modules/tide_landing_page/tide_landing_page.install +++ b/modules/tide_landing_page/tide_landing_page.install @@ -34,7 +34,7 @@ function tide_landing_page_install() { */ function tide_landing_page_update_dependencies() { $dependencies = []; - $dependencies['tide_landing_page'][10102] = ['tide_core' => 10005]; + $dependencies['tide_landing_page'][10101] = ['tide_core' => 10005]; return $dependencies; } diff --git a/modules/tide_publication/config/install/core.entity_view_display.node.publication_page.default.yml b/modules/tide_publication/config/install/core.entity_view_display.node.publication_page.default.yml index fc0836ba4..78929836f 100644 --- a/modules/tide_publication/config/install/core.entity_view_display.node.publication_page.default.yml +++ b/modules/tide_publication/config/install/core.entity_view_display.node.publication_page.default.yml @@ -2,6 +2,7 @@ langcode: en status: true dependencies: config: + - field.field.node.publication.field_content_category - field.field.node.publication_page.field_landing_page_component - field.field.node.publication_page.field_landing_page_contact - field.field.node.publication_page.field_landing_page_hero_image @@ -22,6 +23,7 @@ dependencies: - entity_reference_revisions - options - user + - term_reference_tree id: node.publication_page.default targetEntityType: node bundle: publication_page @@ -39,6 +41,17 @@ content: region: content settings: { } third_party_settings: { } + field_content_category: + type: term_reference_tree + weight: 5 + region: content + settings: + start_minimized: true + leaves_only: true + select_parents: false + cascading_selection: 0 + max_depth: 0 + third_party_settings: { } field_landing_page_component: weight: 1 label: above diff --git a/modules/tide_publication/config/install/field.field.node.publication_page.field_content_category.yml b/modules/tide_publication/config/install/field.field.node.publication_page.field_content_category.yml new file mode 100644 index 000000000..331b98e10 --- /dev/null +++ b/modules/tide_publication/config/install/field.field.node.publication_page.field_content_category.yml @@ -0,0 +1,28 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_content_category + - node.type.publication_page + - taxonomy.vocabulary.content_category +id: node.publication_page.field_content_category +field_name: field_content_category +entity_type: node +bundle: publication_page +label: 'Content category' +description: 'Select the most relevant option from the list of content categories. This mandatory field will help with search and filtering on the website.' +required: true +translatable: true +default_value: { } +default_value_callback: '' +settings: + handler: 'default:taxonomy_term' + handler_settings: + target_bundles: + content_category: content_category + sort: + field: name + direction: asc + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/tide_publication/tests/behat/features/fields.feature b/modules/tide_publication/tests/behat/features/fields.feature index 98e8d921a..bf5d15cb7 100644 --- a/modules/tide_publication/tests/behat/features/fields.feature +++ b/modules/tide_publication/tests/behat/features/fields.feature @@ -179,3 +179,5 @@ Feature: Fields for Publication content type And I see field "Show content rating?" And I should see an "input#edit-field-show-content-rating-value" element And I should not see an "input#edit-field-show-content-rating-value.required" element + + And I should see text matching "Content category" diff --git a/modules/tide_publication/tide_publication.install b/modules/tide_publication/tide_publication.install index 6bb3fb8db..a07c4d800 100644 --- a/modules/tide_publication/tide_publication.install +++ b/modules/tide_publication/tide_publication.install @@ -130,3 +130,20 @@ function tide_publication_update_10004() { $tide_update_helper = \Drupal::service('tide_core.entity_update_helper'); $tide_update_helper->configMergeDeep('tide_landing_page', TideEntityUpdateHelper::INSTALL_DIR, $form_configs); } + +/** + * Imports publication_page.field_content_category for existing sites. + */ +function tide_publication_update_10005() { + \Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers'); + $config_location = [\Drupal::service('extension.list.module')->getPath('tide_publication') . '/config/install']; + $config_read = _tide_read_config('field.field.node.publication_page.field_content_category', $config_location, TRUE); + $storage = \Drupal::entityTypeManager()->getStorage('field_config'); + $id = $storage->getIDFromConfigName('field.field.node.publication_page.field_content_category', $storage->getEntityType()->getConfigPrefix()); + if ($storage->load($id) == NULL) { + $config_entity = $storage->createFromStorageRecord($config_read); + $config_entity->save(); + } + \Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/updates'); + _tide_core_content_category_form_display('publication_page'); +} diff --git a/modules/tide_site/src/AliasManager.php b/modules/tide_site/src/AliasManager.php index b11506c88..7bd15d762 100644 --- a/modules/tide_site/src/AliasManager.php +++ b/modules/tide_site/src/AliasManager.php @@ -26,7 +26,7 @@ class AliasManager extends CoreAliasManager { /** * {@inheritdoc} */ - public function __construct(AliasRepositoryInterface $repository, AliasWhitelistInterface $whitelist, LanguageManagerInterface $language_manager, CacheBackendInterface $cache, protected ?TimeInterface $time = NULL, AliasStorageHelper $alias_helper) { + public function __construct(AliasRepositoryInterface $repository, AliasWhitelistInterface $whitelist, LanguageManagerInterface $language_manager, CacheBackendInterface $cache, protected ?TimeInterface $time, AliasStorageHelper $alias_helper) { parent::__construct($repository, $whitelist, $language_manager, $cache, $time); $this->aliasHelper = $alias_helper; } diff --git a/modules/tide_webform/tide_webform.module b/modules/tide_webform/tide_webform.module index 4755aedc1..976647998 100644 --- a/modules/tide_webform/tide_webform.module +++ b/modules/tide_webform/tide_webform.module @@ -43,7 +43,7 @@ function tide_webform_form_alter(&$form, FormStateInterface $form_state, $form_i if ($form_id == 'webform_ui_element_form') { $form['#after_build'][] = 'tide_webform_webform_ui_element_form_after_build'; $form['#attached']['library'][] = 'tide_webform/webform'; - if (isset($form['properties']['form']['length_container']['maxlength']) && array_key_exists('#default_value', $form['properties']['form']['length_container']['maxlength'])) { + if (isset($form['properties']['form']['length_container']['maxlength']) && array_key_exists('#default_value', $form['properties']['form']['length_container']['maxlength']) && $form['properties']['type']['#value'] === 'textfield') { $default_value = NestedArray::getValue($form, [ 'properties',