function field_inheritance_update_8001 in Field Inheritance 2.0.x
Same name and namespace in other branches
- 8 field_inheritance.install \field_inheritance_update_8001()
Update existing plugins to use the new default plugin.
File
- ./
field_inheritance.install, line 13 - Installation and update hooks for the field_inheritance module.
Code
function field_inheritance_update_8001() {
$inheritances = \Drupal::entityTypeManager()
->getStorage('field_inheritance')
->loadMultiple();
if (!empty($inheritances)) {
foreach ($inheritances as $inheritance) {
if ($inheritance
->plugin() !== 'entity_reference_inheritance') {
$inheritance
->setPlugin('default_inheritance');
$inheritance
->save();
}
}
}
}