Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
70
core/modules/field/field.install
Normal file
70
core/modules/field/field.install
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the field module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem;
|
||||
|
||||
/**
|
||||
* Removes the stale 'target_bundle' storage setting on entity_reference fields.
|
||||
*/
|
||||
function field_update_8001() {
|
||||
$config = \Drupal::configFactory();
|
||||
/** @var \Drupal\Core\Field\FieldTypePluginManager $field_type_manager */
|
||||
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
|
||||
|
||||
// Iterate on all fields storage.
|
||||
foreach ($config->listAll('field.storage.') as $field_id) {
|
||||
$field_storage = $config->getEditable($field_id);
|
||||
$class = $field_type_manager->getPluginClass($field_storage->get('type'));
|
||||
|
||||
// Deal only with entity reference fields and descendants.
|
||||
if ($class == EntityReferenceItem::class || is_subclass_of($class, EntityReferenceItem::class)) {
|
||||
// Remove 'target_bundle' from settings.
|
||||
$field_storage->clear('settings.target_bundle')->save(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The 'entity_reference' field type is now provided by core.
|
||||
*/
|
||||
function field_update_8002() {
|
||||
$config_factory = \Drupal::configFactory();
|
||||
|
||||
// Iterate on all configuration entities.
|
||||
foreach ($config_factory->listAll() as $id) {
|
||||
$changed = FALSE;
|
||||
$config = $config_factory->getEditable($id);
|
||||
|
||||
// Update field storage configurations.
|
||||
if (strpos($id, 'field.storage.') === 0) {
|
||||
// Deal only with entity reference fields.
|
||||
if ($config->get('type') == 'entity_reference') {
|
||||
// Fix the type provider.
|
||||
$config->set('module', 'core');
|
||||
$changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove entity_reference module dependency from any configuration entity.
|
||||
if ($dependencies = $config->get('dependencies.module')) {
|
||||
if (($delta = array_search('entity_reference', $dependencies)) !== FALSE) {
|
||||
unset($dependencies[$delta]);
|
||||
if ($dependencies) {
|
||||
$config->set('dependencies.module', array_values($dependencies));
|
||||
}
|
||||
else {
|
||||
$config->clear('dependencies.module');
|
||||
}
|
||||
$changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ($changed) {
|
||||
$config->save(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue