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

Commit

Permalink
updated hook
Browse files Browse the repository at this point in the history
  • Loading branch information
yeniatencio committed Feb 7, 2024
1 parent 97c167f commit 8611976
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tide_search.install
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@ function tide_search_update_10001() {
* Adds field_above_results_content field to search listing.
*/
function tide_search_update_10002() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
module_load_include('inc', 'tide_core', 'includes/helpers');

// \Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_search') . '/config/optional'];

$field_configs = [
'field.field.node.tide_search_listing.field_above_results_content',
'field.storage.node.field_above_results_content',
'field.field.node.tide_search_listing.field_above_results_content' => 'field_config',
'field.storage.node.field_above_results_content' => 'field_storage_config',
];
foreach ($field_configs as $config) {
$type = 'field_config';
$config_read = _tide_read_config($config, $config_location);
// 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 = substr($config, strrpos($config, '.') + 1);
if ($storage->load($id) == NULL) {
$config_entity = $storage->createFromStorageRecord($config_read);
$config_entity->save();
}
$config_entity = $storage->createFromStorageRecord($config_read);
$config_entity->save();
}

$form_configs = [
Expand Down

0 comments on commit 8611976

Please sign in to comment.