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

Commit

Permalink
added config field and hook (#156)
Browse files Browse the repository at this point in the history
* added config field and hook

* added storage field

* fixed lint

* added hash commit

* updated hook

* update hook update

* added form configs files

* cleaned files

* removed unwanted file

* updated label
  • Loading branch information
yeniatencio authored Jul 22, 2024
1 parent 747a7c7 commit d135c39
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies:
config:
- entity_browser.browser.tide_image_browser
- field.field.taxonomy_term.sites.field_acknowledgement_to_country
- 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_show_table_of_contents
Expand Down Expand Up @@ -38,7 +39,7 @@ third_party_settings:
label: 'Table of contents'
region: content
parent_name: ''
weight: 17
weight: 19
format_type: details
format_settings:
classes: ''
Expand All @@ -54,7 +55,15 @@ mode: default
content:
field_acknowledgement_to_country:
type: string_textarea
weight: 11
weight: 13
region: content
settings:
rows: 5
placeholder: ''
third_party_settings: { }
field_additional_comment:
type: text_textarea
weight: 5
region: content
settings:
rows: 5
Expand All @@ -69,7 +78,7 @@ content:
third_party_settings: { }
field_prominence_ack_to_country:
type: string_textarea
weight: 12
weight: 14
region: content
settings:
rows: 5
Expand Down Expand Up @@ -97,7 +106,7 @@ content:
maxlength_js_truncate_html: false
field_site_footer_logos:
type: entity_reference_paragraphs
weight: 8
weight: 9
region: content
settings:
title: Paragraph
Expand All @@ -110,7 +119,7 @@ content:
third_party_settings: { }
field_site_footer_menu:
type: entity_reference_autocomplete
weight: 6
weight: 7
region: content
settings:
match_operator: CONTAINS
Expand All @@ -120,15 +129,15 @@ content:
third_party_settings: { }
field_site_footer_text:
type: text_textarea
weight: 7
weight: 8
region: content
settings:
rows: 5
placeholder: ''
third_party_settings: { }
field_site_homepage:
type: entity_reference_autocomplete
weight: 9
weight: 10
region: content
settings:
match_operator: CONTAINS
Expand All @@ -146,7 +155,7 @@ content:
third_party_settings: { }
field_site_main_menu:
type: entity_reference_autocomplete
weight: 5
weight: 6
region: content
settings:
match_operator: CONTAINS
Expand All @@ -156,7 +165,7 @@ content:
third_party_settings: { }
field_site_og_image:
type: entity_browser_entity_reference
weight: 13
weight: 15
region: content
settings:
entity_browser: tide_image_browser
Expand All @@ -171,7 +180,7 @@ content:
third_party_settings: { }
field_site_show_exit_site:
type: boolean_checkbox
weight: 10
weight: 11
region: content
settings:
display_label: true
Expand All @@ -186,7 +195,7 @@ content:
third_party_settings: { }
field_site_social_links:
type: link_default
weight: 15
weight: 17
region: content
settings:
placeholder_url: 'https://example.com/Social'
Expand All @@ -197,7 +206,7 @@ content:
maxlength_js_label: 'Link text limited to @limit characters, remaining: <strong>@remaining</strong>'
field_site_twitter_image:
type: entity_browser_entity_reference
weight: 14
weight: 16
region: content
settings:
entity_browser: tide_image_browser
Expand Down Expand Up @@ -228,7 +237,7 @@ content:
third_party_settings: { }
status:
type: boolean_checkbox
weight: 16
weight: 18
region: content
settings:
display_label: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ status: true
dependencies:
config:
- field.field.taxonomy_term.sites.field_acknowledgement_to_country
- 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_show_table_of_contents
Expand Down Expand Up @@ -178,4 +179,5 @@ content:
region: content
hidden:
description: true
field_additional_comment: true
search_api_excerpt: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
langcode: en
status: true
dependencies:
config:
- field.storage.taxonomy_term.field_additional_comment
- taxonomy.vocabulary.sites
module:
- allowed_formats
- text
third_party_settings:
allowed_formats:
allowed_formats: { }
id: taxonomy_term.sites.field_additional_comment
field_name: field_additional_comment
entity_type: taxonomy_term
bundle: sites
label: 'Content rating form help text'
description: ''
required: false
translatable: false
default_value:
-
value: '<p><span>If you need a response, please use our </span><a class="rpl-text-link rpl-u-focusable-inline" href="https://www.vic.gov.au/contact-us">contact us form</a><span>.</span></p>'
format: rich_text
default_value_callback: ''
settings:
allowed_formats: { }
field_type: text_long
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
langcode: en
status: true
dependencies:
module:
- field_permissions
- taxonomy
- text
third_party_settings:
field_permissions:
permission_type: public
id: taxonomy_term.field_additional_comment
field_name: field_additional_comment
entity_type: taxonomy_term
type: text_long
settings: { }
module: text
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
1 change: 1 addition & 0 deletions tests/behat/features/sites.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Feature: Sites taxonomy vocabulary
And I see field "Slogan"
And I see field "Logo"
And I see field "Footer text"
And I see field "Additional comment"
And I see field "Domains"
And I see field "Main menu"
And I see field "Footer menu"
Expand Down
33 changes: 33 additions & 0 deletions tide_site.install
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,36 @@ function tide_site_install() {
}
}
}

/**
* New field taxonomy image logo.
*/
function tide_site_update_10001() {
module_load_include('inc', 'tide_core', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_site') . '/config/install'];

$configs = [
'field.storage.taxonomy_term.field_additional_comment' => 'field_storage_config',
'field.field.taxonomy_term.sites.field_additional_comment' => 'field_config',
];
// 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);
$config_entity = $storage->createFromStorageRecord($config_read);
$config_entity->save();
}

$form_configs = [
'core.entity_form_display.taxonomy_term.sites.default',
'core.entity_view_display.taxonomy_term.sites.default',
];
foreach ($form_configs as $form_config) {
$config = \Drupal::configFactory()->getEditable($form_config);
$config_read = _tide_read_config($form_config, $config_location, FALSE);
$config->set('dependencies', $config_read['dependencies']);
$config->set('content', $config_read['content']);
$config->set('hidden', $config_read['hidden']);
$config->save();
}
}

0 comments on commit d135c39

Please sign in to comment.