function media_entity_update_8001 in Media entity 8
Same name and namespace in other branches
- 8.2 media_entity.install \media_entity_update_8001()
Remove "type" base field.
File
- ./
media_entity.install, line 70 - Install, uninstall and update hooks for Media entity module.
Code
function media_entity_update_8001() {
$fields = \Drupal::database()
->query('DESCRIBE {media_field_data}')
->fetchCol();
if (in_array('type', $fields)) {
\Drupal::database()
->update('media_field_data')
->fields([
'type' => NULL,
])
->execute();
}
$manager = \Drupal::entityDefinitionUpdateManager();
if ($field = $manager
->getFieldStorageDefinition('type', 'media')) {
$manager
->uninstallFieldStorageDefinition($field);
}
}