Update to Drupal 8.0.3. For more information, see https://www.drupal.org/drupal-8.0.3-release-notes
This commit is contained in:
parent
10f9f7fbde
commit
9db4fae9a7
202 changed files with 3806 additions and 760 deletions
|
@ -440,7 +440,8 @@ abstract class ContentEntityStorageBase extends EntityStorageBase implements Con
|
|||
protected function invokeFieldMethod($method, ContentEntityInterface $entity) {
|
||||
$result = [];
|
||||
$args = array_slice(func_get_args(), 2);
|
||||
foreach (array_keys($entity->getTranslationLanguages()) as $langcode) {
|
||||
$langcodes = array_keys($entity->getTranslationLanguages());
|
||||
foreach ($langcodes as $langcode) {
|
||||
$translation = $entity->getTranslation($langcode);
|
||||
// For non translatable fields, there is only one field object instance
|
||||
// across all translations and it has as parent entity the entity in the
|
||||
|
@ -453,6 +454,20 @@ abstract class ContentEntityStorageBase extends EntityStorageBase implements Con
|
|||
$result[$langcode][$name] = $args ? call_user_func_array([$items, $method], $args) : $items->{$method}();
|
||||
}
|
||||
}
|
||||
|
||||
// We need to call the delete method for field items of removed
|
||||
// translations.
|
||||
if ($method == 'postSave' && !empty($entity->original)) {
|
||||
$original_langcodes = array_keys($entity->original->getTranslationLanguages());
|
||||
foreach (array_diff($original_langcodes, $langcodes) as $removed_langcode) {
|
||||
$translation = $entity->original->getTranslation($removed_langcode);
|
||||
$fields = $translation->getTranslatableFields();
|
||||
foreach ($fields as $name => $items) {
|
||||
$items->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -330,11 +330,11 @@ class EntityAutocomplete extends Textfield {
|
|||
|
||||
// Take "label (entity id)', match the ID from parenthesis when it's a
|
||||
// number.
|
||||
if (preg_match("/.+\((\d+)\)/", $input, $matches)) {
|
||||
if (preg_match("/.+\s\((\d+)\)/", $input, $matches)) {
|
||||
$match = $matches[1];
|
||||
}
|
||||
// Match the ID when it's a string (e.g. for config entity types).
|
||||
elseif (preg_match("/.+\(([\w.]+)\)/", $input, $matches)) {
|
||||
elseif (preg_match("/.+\s\(([\w.]+)\)/", $input, $matches)) {
|
||||
$match = $matches[1];
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue