function eck_update_8001 in Entity Construction Kit (ECK) 8
Enable all base fields for existing ECK entity types.
File
- ./
eck.install, line 13
Code
function eck_update_8001() {
$entity_types = \Drupal::entityTypeManager()
->getStorage('eck_entity_type')
->loadMultiple();
$names = [];
foreach ($entity_types as $entity_type) {
$names[] = "eck.eck_entity_type.{$entity_type->id()}";
}
foreach ($names as $name) {
$config = \Drupal::configFactory()
->getEditable($name);
$data = $config
->getRawData();
foreach ([
'uid',
'title',
'created',
'changed',
] as $field) {
$data[$field] = TRUE;
}
$config
->setData($data);
$config
->save();
}
drupal_flush_all_caches();
EntityDefinitionUpdateManagerInterface::getChangeList();
}