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

Commit

Permalink
Merge branch 'develop' into feature/SDPAP-8873-add-department-field
Browse files Browse the repository at this point in the history
  • Loading branch information
yeniatencio authored Mar 3, 2024
2 parents c79c878 + bb8f574 commit be00e3c
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
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.tide_search_listing.field_above_results_content
- field.field.node.tide_search_listing.field_below_results_content
- field.field.node.tide_search_listing.field_custom_sort_configuration
- field.field.node.tide_search_listing.field_featured_image
Expand Down Expand Up @@ -148,6 +149,14 @@ content:
region: content
settings: { }
third_party_settings: { }
field_above_results_content:
type: text_textarea
weight: 7
region: content
settings:
rows: 5
placeholder: ''
third_party_settings: { }
field_below_results_content:
type: text_textarea
weight: 8
Expand Down
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.tide_search_listing.field_above_results_content
- field.field.node.tide_search_listing.field_below_results_content
- field.field.node.tide_search_listing.field_custom_sort_configuration
- field.field.node.tide_search_listing.field_featured_image
Expand Down Expand Up @@ -43,6 +44,13 @@ content:
third_party_settings: { }
weight: -20
region: content
field_above_results_content:
type: text_default
label: above
settings: { }
third_party_settings: { }
weight: 16
region: content
field_below_results_content:
type: text_default
label: above
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
- field.field.node.tide_search_listing.field_above_results_content
- field.field.node.tide_search_listing.field_below_results_content
- field.field.node.tide_search_listing.field_custom_sort_configuration
- field.field.node.tide_search_listing.field_featured_image
Expand Down Expand Up @@ -46,6 +47,7 @@ content:
weight: 100
region: content
hidden:
field_above_results_content: true
field_below_results_content: true
field_custom_sort_configuration: true
field_featured_image: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_above_results_content
- node.type.tide_search_listing
module:
- allowed_formats
- text
third_party_settings:
allowed_formats:
allowed_formats: { }
id: node.tide_search_listing.field_above_results_content
field_name: field_above_results_content
entity_type: node
bundle: tide_search_listing
label: 'Above results content'
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: text_long
22 changes: 22 additions & 0 deletions config/optional/field.storage.node.field_above_results_content.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
langcode: en
status: true
dependencies:
module:
- field_permissions
- node
- text
third_party_settings:
field_permissions:
permission_type: public
id: node.field_above_results_content
field_name: field_above_results_content
entity_type: node
type: text_long
settings: { }
module: text
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
34 changes: 34 additions & 0 deletions tide_search.install
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,37 @@ function tide_search_update_10002() {
$config->save();
}
}

/**
* Adds field_above_results_content field to search listing.
*/
function tide_search_update_10003() {
module_load_include('inc', 'tide_core', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_search') . '/config/optional'];

$configs = [
'field.storage.node.field_above_results_content' => 'field_storage_config',
'field.field.node.tide_search_listing.field_above_results_content' => '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.node.tide_search_listing.default',
'core.entity_view_display.node.tide_search_listing.default',
'core.entity_view_display.node.tide_search_listing.teaser',
];
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 be00e3c

Please sign in to comment.