Create reverse relationships for ER bundle fields after they are installed.

This commit is contained in:
paul121 2021-04-26 11:13:05 -07:00 committed by Michael Stenta
parent 3bf4dadd47
commit 292d46878a
2 changed files with 21 additions and 1 deletions

View File

@ -52,7 +52,7 @@
"Issue #2339235: Remove taxonomy hard dependency on node module": "https://www.drupal.org/files/issues/2020-10-12/2339235_60.patch"
},
"drupal/entity": {
"Issue #3206703: Provide reverse relationships for bundle plugin entity_reference fields.": "https://www.drupal.org/files/issues/2021-04-09/3206703-4.patch"
"Issue #3206703: Provide reverse relationships for bundle plugin entity_reference fields.": "https://www.drupal.org/files/issues/2021-05-18/3206703-7.patch"
},
"drupal/entity_browser": {
"Issue #3160482: Error with UntrustedCallbackException": "https://www.drupal.org/files/issues/2021-03-02/error-with-untrustedcallbackexception-3160482-5.patch"

View File

@ -28,6 +28,15 @@ function farm_entity_module_implements_alter(&$implementations, $hook) {
unset($implementations[$module]);
$implementations = array_merge($implementation, $implementations);
}
// Make sure this module's hook_modules_installed runs after the entity
// module's implementation, so that we rebuild views data after bundle fields
// are installed.
if ($hook == 'modules_installed') {
$implementation = [$module => $implementations[$module]];
unset($implementations[$module]);
$implementations = array_merge($implementations, $implementation);
}
}
/**
@ -262,6 +271,17 @@ function farm_entity_form_log_form_alter(&$form, FormStateInterface $form_state,
}
}
/**
* Implements hook_modules_installed().
*/
function farm_entity_modules_installed($modules, $is_syncing) {
// Reset the views data after installing modules.
// See https://www.drupal.org/project/entity/issues/3206703#comment-14073184
if (\Drupal::hasService('views.views_data')) {
\Drupal::service('views.views_data')->clear();
}
}
/**
* Implements hook_views_data_alter().
*/