Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -61,14 +61,14 @@ class Term extends ContentEntityBase implements TermInterface {
parent::postDelete($storage, $entities);
// See if any of the term's children are about to be become orphans.
$orphans = array();
$orphans = [];
foreach (array_keys($entities) as $tid) {
if ($children = $storage->loadChildren($tid)) {
foreach ($children as $child) {
// If the term has multiple parents, we don't delete it.
$parents = $storage->loadParents($child->id());
if (empty($parents)) {
$orphans[] = $child->id();
$orphans[] = $child;
}
}
}
@ -79,7 +79,7 @@ class Term extends ContentEntityBase implements TermInterface {
$storage->deleteTermHierarchy(array_keys($entities));
if (!empty($orphans)) {
entity_delete_multiple('taxonomy_term', $orphans);
$storage->delete($orphans);
}
}
@ -92,7 +92,7 @@ class Term extends ContentEntityBase implements TermInterface {
// Only change the parents if a value is set, keep the existing values if
// not.
if (isset($this->parent->target_id)) {
$storage->deleteTermHierarchy(array($this->id()));
$storage->deleteTermHierarchy([$this->id()]);
$storage->updateTermHierarchy($this);
}
}
@ -116,35 +116,33 @@ class Term extends ContentEntityBase implements TermInterface {
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The term name.'))
->setTranslatable(TRUE)
->setRequired(TRUE)
->setSetting('max_length', 255)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'string',
'weight' => -5,
))
->setDisplayOptions('form', array(
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -5,
))
])
->setDisplayConfigurable('form', TRUE);
$fields['description'] = BaseFieldDefinition::create('text_long')
->setLabel(t('Description'))
->setDescription(t('A description of the term.'))
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'text_default',
'weight' => 0,
))
])
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('form', array(
->setDisplayOptions('form', [
'type' => 'text_textfield',
'weight' => 0,
))
])
->setDisplayConfigurable('form', TRUE);
$fields['weight'] = BaseFieldDefinition::create('integer')
@ -234,4 +232,17 @@ class Term extends ContentEntityBase implements TermInterface {
return $this->get('vid')->target_id;
}
/**
* {@inheritdoc}
*/
protected function getFieldsToSkipFromTranslationChangesCheck() {
// @todo the current implementation of the parent field makes it impossible
// for ::hasTranslationChanges() to correctly check the field for changes,
// so it is currently skipped from the comparision and has to be fixed by
// https://www.drupal.org/node/2843060.
$fields = parent::getFieldsToSkipFromTranslationChangesCheck();
$fields[] = 'parent';
return $fields;
}
}

View file

@ -140,13 +140,13 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface {
return;
}
$vocabularies = array();
$vocabularies = [];
foreach ($entities as $vocabulary) {
$vocabularies[$vocabulary->id()] = $vocabulary->id();
}
// Load all Taxonomy module fields and delete those which use only this
// vocabulary.
$field_storages = entity_load_multiple_by_properties('field_storage_config', array('module' => 'taxonomy'));
$field_storages = entity_load_multiple_by_properties('field_storage_config', ['module' => 'taxonomy']);
foreach ($field_storages as $field_storage) {
$modified_storage = FALSE;
// Term reference fields may reference terms from more than one