Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SD-356]added content category to publication page #523

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,6 +23,7 @@ dependencies:
- entity_reference_revisions
- options
- user
- term_reference_tree
id: node.publication_page.default
targetEntityType: node
bundle: publication_page
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <a href="https://www.vic.gov.au/content-categories">list of content categories</a>. 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
17 changes: 17 additions & 0 deletions modules/tide_publication/tide_publication.install
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Loading