Issue #2048833 by larowlan, andypost: Fixed Prepare cache called on field items without checking if PrepareCacheInterface is implemented.
parent
8043b9aa34
commit
1aebdc7390
|
@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityNG;
|
|||
use Drupal\entity\Plugin\Core\Entity\EntityDisplay;
|
||||
use Drupal\entity\Plugin\Core\Entity\EntityFormDisplay;
|
||||
use Drupal\Core\Language\Language;
|
||||
use Drupal\Core\Entity\Field\PrepareCacheInterface;
|
||||
|
||||
/**
|
||||
* @defgroup field_storage Field Storage API
|
||||
|
@ -678,7 +679,9 @@ function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $
|
|||
$definition = _field_generate_entity_field_definition($field, $options['instance']);
|
||||
$items = \Drupal::typedData()->create($definition, $values, $field_name, $entity);
|
||||
foreach ($items as $item) {
|
||||
$item->prepareCache();
|
||||
if ($item instanceof PrepareCacheInterface) {
|
||||
$item->prepareCache();
|
||||
}
|
||||
}
|
||||
$entity->{$field_name}[$langcode] = $items->getValue();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\field\Plugin\field\field_type;
|
||||
|
||||
use Drupal\Core\Entity\Field\PrepareCacheInterface;
|
||||
use Drupal\field\Plugin\Type\FieldType\ConfigFieldItemBase;
|
||||
use Drupal\field\Plugin\Core\Entity\Field;
|
||||
|
||||
|
@ -23,7 +24,7 @@ use Drupal\field\Plugin\Core\Entity\Field;
|
|||
* @todo Remove once all core field types have been converted (see
|
||||
* http://drupal.org/node/2014671).
|
||||
*/
|
||||
abstract class LegacyConfigFieldItem extends ConfigFieldItemBase {
|
||||
abstract class LegacyConfigFieldItem extends ConfigFieldItemBase implements PrepareCacheInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
Loading…
Reference in New Issue