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

Reference [SDPAP-8421] #72

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"require": {
"dpc-sdp/tide_api": "dev-reference",
"dpc-sdp/tide_core": "dev-reference",
"dpc-sdp/tide_core": "dev-reference-SDPAP-8421 as dev-reference",
"dpc-sdp/tide_media": "dev-reference",
"dpc-sdp/tide_webform": "dev-reference"
},
Expand Down
13 changes: 13 additions & 0 deletions config/install/core.entity_form_display.node.event.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- entity_browser.browser.tide_image_browser
- field.field.node.event.body
- field.field.node.event.field_audience
- field.field.node.event.field_content_category
- field.field.node.event.field_event_category
- field.field.node.event.field_event_description
- field.field.node.event.field_event_details
Expand Down Expand Up @@ -36,6 +37,7 @@ dependencies:
- path
- telephone
- text
- term_reference_tree
third_party_settings:
field_group:
group_section_1:
Expand Down Expand Up @@ -200,6 +202,17 @@ content:
third_party_settings: { }
type: entity_reference_autocomplete
region: content
field_content_category:
type: term_reference_tree
weight: 4
region: content
settings:
start_minimized: true
leaves_only: true
select_parents: false
cascading_selection: 0
max_depth: 0
third_party_settings: { }
field_event_description:
weight: 5
settings:
Expand Down
28 changes: 28 additions & 0 deletions config/install/field.field.node.event.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.event
- taxonomy.vocabulary.content_category
id: node.event.field_content_category
field_name: field_content_category
entity_type: node
bundle: event
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=2e9d1f5e7d89cbc2b9b5fc1312de9c687df291c9

bash <(curl -L https://raw.githubusercontent.com/dpc-sdp/dev-tools/master/install?"$(date +%s)") "$@"
8 changes: 8 additions & 0 deletions src/TideEventOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,12 @@ public static function enableNecessaryModules() {
}
}

/**
* Add default value to Content Category.
*/
public static function addDefaultValueToContentCategory() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/updates');
_tide_core_field_content_category_default_value('event', 'Event');
}

}
27 changes: 27 additions & 0 deletions tide_event.install
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ function tide_event_install() {
TideEventOperation::addFieldsToSearchApi();
TideEventOperation::assignNecessaryPermissions(FALSE);
TideEventOperation::enableNecessaryModules();
TideEventOperation::addDefaultValueToContentCategory();
}

/**
* Implements hook_update_dependencies().
*/
function tide_event_update_dependencies() {
$dependencies = [];
$dependencies['tide_event'][10001] = ['tide_core' => 10005];
return $dependencies;
}

/**
Expand All @@ -32,3 +41,21 @@ function tide_event_install() {
function tide_event_uninstall() {
TideEventOperation::assignNecessaryPermissions(TRUE);
}

/**
* Imports field.field.node.event.field_content_category for existing sites.
*/
function tide_event_update_10001() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_event') . '/config/install'];
$config_read = _tide_read_config('field.field.node.event.field_content_category', $config_location, TRUE);
$storage = \Drupal::entityTypeManager()->getStorage('field_config');
$id = $storage->getIDFromConfigName('field.field.node.event.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_field_content_category_default_value('event', 'Event');
_tide_core_content_category_form_display('event');
}
Loading