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

Commit

Permalink
added hook update
Browse files Browse the repository at this point in the history
  • Loading branch information
yeniatencio committed Aug 28, 2024
1 parent 1003dcc commit dfc8068
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies:
- field.field.taxonomy_term.sites.field_acknowledgement_to_country
- field.field.taxonomy_term.sites.field_additional_comment
- field.field.taxonomy_term.sites.field_bottom_corner_graphic
- field.field.taxonomy_term.sites.field_short_name
- field.field.taxonomy_term.sites.field_site_app_icon
- field.field.taxonomy_term.sites.field_print_friendly_logo
- field.field.taxonomy_term.sites.field_prominence_ack_to_country
Expand Down Expand Up @@ -186,14 +185,6 @@ content:
settings:
display_label: true
third_party_settings: { }
field_short_name:
type: string_textfield
weight: 24
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_site_app_icon:
type: image_image
weight: 25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies:
- field.field.taxonomy_term.sites.field_additional_comment
- field.field.taxonomy_term.sites.field_print_friendly_logo
- field.field.taxonomy_term.sites.field_prominence_ack_to_country
- field.field.taxonomy_term.sites.field_short_name
- field.field.taxonomy_term.sites.field_site_app_icon
- field.field.taxonomy_term.sites.field_show_table_of_contents
- field.field.taxonomy_term.sites.field_site_domains
Expand Down Expand Up @@ -40,14 +39,6 @@ content:
third_party_settings: { }
weight: 9
region: content
field_short_name:
type: string
label: above
settings:
link_to_entity: false
third_party_settings: { }
weight: 22
region: content
field_site_app_icon:
type: image
label: above
Expand Down

This file was deleted.

21 changes: 0 additions & 21 deletions config/install/field.storage.taxonomy_term.field.short_name.yml

This file was deleted.

44 changes: 44 additions & 0 deletions modules/tide_site_theming/tide_site_theming.install
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,47 @@ function tide_site_theming_update_8001() {
}
$config->save();
}

/**
* Add site app icon field.
*/
function tide_site_theming_update_10001() {
$configs = [
'field.storage.taxonomy_term.field_site_app_icon' => 'field_storage_config',
'field.field.taxonomy_term.sites.field_site_app_icon' => 'field_config',
];
module_load_include('inc', 'tide_core', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_site_theming') . '/config/install'];
// Check if field already exported to config/sync.
foreach ($configs as $config => $type) {
$config_read = _tide_read_config($config, $config_location, TRUE);
$storage = \Drupal::entityTypeManager()->getStorage($type);
$id = $storage->getIDFromConfigName($config, $storage->getEntityType()->getConfigPrefix());
if ($storage->load($id) == NULL) {
$config_entity = $storage->createFromStorageRecord($config_read);
$config_entity->save();
}
}

// Add to JSON.
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('jsonapi_extras.jsonapi_resource_config.taxonomy_term--sites');
$resourcefields_fields = [
'field_site_app_icon',
];
$content = $config->get('resourceFields');
foreach ($resourcefields_fields as $field) {
if (!isset($content[$field])) {
$content[$field] = [
'fieldName' => $field,
'publicName' => $field,
'enhancer' => [
'id' => '',
],
'disabled' => FALSE,
];
$config->set('resourceFields', $content);
}
}
$config->save();
}

0 comments on commit dfc8068

Please sign in to comment.