Issue #2200821 by yched, plopesc, Berdir, claudiu.cristea, swentel: Rename Fieldinterface and FieldInstanceInterface.

8.0.x
webchick 2014-02-22 21:16:46 -08:00
parent f19fadd3a4
commit 01457d74ea
34 changed files with 157 additions and 157 deletions

View File

@ -16,8 +16,8 @@ use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Uuid\Uuid; use Drupal\Component\Uuid\Uuid;
use Drupal\field\FieldInfo; use Drupal\field\FieldInfo;
use Drupal\field\FieldUpdateForbiddenException; use Drupal\field\FieldUpdateForbiddenException;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;

View File

@ -15,8 +15,8 @@ use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Uuid\Uuid; use Drupal\Component\Uuid\Uuid;
use Drupal\field\FieldInfo; use Drupal\field\FieldInfo;
use Drupal\field\FieldUpdateForbiddenException; use Drupal\field\FieldUpdateForbiddenException;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
@ -820,7 +820,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
$delta_count[$row->entity_id][$row->langcode] = 0; $delta_count[$row->entity_id][$row->langcode] = 0;
} }
if ($field->getCardinality() == FieldInterface::CARDINALITY_UNLIMITED || $delta_count[$row->entity_id][$row->langcode] < $field->getCardinality()) { if ($field->getCardinality() == FieldConfigInterface::CARDINALITY_UNLIMITED || $delta_count[$row->entity_id][$row->langcode] < $field->getCardinality()) {
$item = array(); $item = array();
// For each column declared by the field, populate the item from the // For each column declared by the field, populate the item from the
// prefixed database column. // prefixed database column.
@ -906,7 +906,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
$query->values($record); $query->values($record);
$revision_query->values($record); $revision_query->values($record);
if ($field->getCardinality() != FieldInterface::CARDINALITY_UNLIMITED && ++$delta_count == $field->getCardinality()) { if ($field->getCardinality() != FieldConfigInterface::CARDINALITY_UNLIMITED && ++$delta_count == $field->getCardinality()) {
break; break;
} }
} }
@ -960,7 +960,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldCreate(FieldInterface $field) { public function onFieldCreate(FieldConfigInterface $field) {
$schema = $this->_fieldSqlSchema($field); $schema = $this->_fieldSqlSchema($field);
foreach ($schema as $name => $table) { foreach ($schema as $name => $table) {
$this->database->schema()->createTable($name, $table); $this->database->schema()->createTable($name, $table);
@ -970,7 +970,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldUpdate(FieldInterface $field) { public function onFieldUpdate(FieldConfigInterface $field) {
$original = $field->original; $original = $field->original;
if (!$field->hasData()) { if (!$field->hasData()) {
@ -1057,7 +1057,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldDelete(FieldInterface $field) { public function onFieldDelete(FieldConfigInterface $field) {
// Mark all data associated with the field for deletion. // Mark all data associated with the field for deletion.
$table = static::_fieldTableName($field); $table = static::_fieldTableName($field);
$revision_table = static::_fieldRevisionTableName($field); $revision_table = static::_fieldRevisionTableName($field);
@ -1078,7 +1078,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onInstanceDelete(FieldInstanceInterface $instance) { public function onInstanceDelete(FieldInstanceConfigInterface $instance) {
$field = $instance->getField(); $field = $instance->getField();
$table_name = static::_fieldTableName($field); $table_name = static::_fieldTableName($field);
$revision_name = static::_fieldRevisionTableName($field); $revision_name = static::_fieldRevisionTableName($field);
@ -1118,7 +1118,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function readFieldItemsToPurge(EntityInterface $entity, FieldInstanceInterface $instance) { protected function readFieldItemsToPurge(EntityInterface $entity, FieldInstanceConfigInterface $instance) {
$field = $instance->getField(); $field = $instance->getField();
$table_name = static::_fieldTableName($field); $table_name = static::_fieldTableName($field);
$query = $this->database->select($table_name, 't', array('fetch' => \PDO::FETCH_ASSOC)) $query = $this->database->select($table_name, 't', array('fetch' => \PDO::FETCH_ASSOC))
@ -1133,7 +1133,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function purgeFieldItems(EntityInterface $entity, FieldInstanceInterface $instance) { public function purgeFieldItems(EntityInterface $entity, FieldInstanceConfigInterface $instance) {
$field = $instance->getField(); $field = $instance->getField();
$table_name = static::_fieldTableName($field); $table_name = static::_fieldTableName($field);
$revision_name = static::_fieldRevisionTableName($field); $revision_name = static::_fieldRevisionTableName($field);
@ -1148,7 +1148,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldPurge(FieldInterface $field) { public function onFieldPurge(FieldConfigInterface $field) {
$table_name = static::_fieldTableName($field); $table_name = static::_fieldTableName($field);
$revision_name = static::_fieldRevisionTableName($field); $revision_name = static::_fieldRevisionTableName($field);
$this->database->schema()->dropTable($table_name); $this->database->schema()->dropTable($table_name);
@ -1162,7 +1162,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* strongly discouraged. This function is not considered part of the public * strongly discouraged. This function is not considered part of the public
* API and modules relying on it might break even in minor releases. * API and modules relying on it might break even in minor releases.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field object * The field object
* @param array $schema * @param array $schema
* The field schema array. Mandatory for upgrades, omit otherwise. * The field schema array. Mandatory for upgrades, omit otherwise.
@ -1173,7 +1173,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* *
* @see hook_schema() * @see hook_schema()
*/ */
public static function _fieldSqlSchema(FieldInterface $field, array $schema = NULL) { public static function _fieldSqlSchema(FieldConfigInterface $field, array $schema = NULL) {
if ($field->deleted) { if ($field->deleted) {
$description_current = "Data storage for deleted field {$field->uuid()} ({$field->entity_type}, {$field->getName()})."; $description_current = "Data storage for deleted field {$field->uuid()} ({$field->entity_type}, {$field->getName()}).";
$description_revision = "Revision archive storage for deleted field {$field->uuid()} ({$field->entity_type}, {$field->getName()})."; $description_revision = "Revision archive storage for deleted field {$field->uuid()} ({$field->entity_type}, {$field->getName()}).";
@ -1331,14 +1331,14 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* support. Always call entity_load() before using the data found in the * support. Always call entity_load() before using the data found in the
* table. * table.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field object. * The field object.
* *
* @return string * @return string
* A string containing the generated name for the database table. * A string containing the generated name for the database table.
* *
*/ */
static public function _fieldTableName(FieldInterface $field) { static public function _fieldTableName(FieldConfigInterface $field) {
if ($field->deleted) { if ($field->deleted) {
// When a field is a deleted, the table is renamed to // When a field is a deleted, the table is renamed to
// {field_deleted_data_FIELD_UUID}. To make sure we don't end up with // {field_deleted_data_FIELD_UUID}. To make sure we don't end up with
@ -1361,13 +1361,13 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* support. Always call entity_load() before using the data found in the * support. Always call entity_load() before using the data found in the
* table. * table.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field object. * The field object.
* *
* @return string * @return string
* A string containing the generated name for the database table. * A string containing the generated name for the database table.
*/ */
static public function _fieldRevisionTableName(FieldInterface $field) { static public function _fieldRevisionTableName(FieldConfigInterface $field) {
if ($field->deleted) { if ($field->deleted) {
// When a field is a deleted, the table is renamed to // When a field is a deleted, the table is renamed to
// {field_deleted_revision_FIELD_UUID}. To make sure we don't end up with // {field_deleted_revision_FIELD_UUID}. To make sure we don't end up with
@ -1386,7 +1386,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* The method accounts for a maximum table name length of 64 characters, and * The method accounts for a maximum table name length of 64 characters, and
* takes care of disambiguation. * takes care of disambiguation.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field object. * The field object.
* @param bool $revision * @param bool $revision
* TRUE for revision table, FALSE otherwise. * TRUE for revision table, FALSE otherwise.
@ -1394,7 +1394,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* @return string * @return string
* The final table name. * The final table name.
*/ */
static protected function _generateFieldTableName(FieldInterface $field, $revision) { static protected function _generateFieldTableName(FieldConfigInterface $field, $revision) {
$separator = $revision ? '_revision__' : '__'; $separator = $revision ? '_revision__' : '__';
$table_name = $field->entity_type . $separator . $field->name; $table_name = $field->entity_type . $separator . $field->name;
// Limit the string to 48 characters, keeping a 16 characters margin for db // Limit the string to 48 characters, keeping a 16 characters margin for db
@ -1418,7 +1418,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* strongly discouraged. This function is not considered part of the public * strongly discouraged. This function is not considered part of the public
* API and modules relying on it might break even in minor releases. * API and modules relying on it might break even in minor releases.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field structure * The field structure
* @param string $index * @param string $index
* The name of the index. * The name of the index.
@ -1427,7 +1427,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* A string containing a generated index name for a field data table that is * A string containing a generated index name for a field data table that is
* unique among all other fields. * unique among all other fields.
*/ */
static public function _fieldIndexName(FieldInterface $field, $index) { static public function _fieldIndexName(FieldConfigInterface $field, $index) {
return $field->getName() . '_' . $index; return $field->getName() . '_' . $index;
} }
@ -1441,7 +1441,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* support. Always call entity_load() before using the data found in the * support. Always call entity_load() before using the data found in the
* table. * table.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field object. * The field object.
* @param string $column * @param string $column
* The name of the column. * The name of the column.
@ -1450,7 +1450,7 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle
* A string containing a generated column name for a field data table that is * A string containing a generated column name for a field data table that is
* unique among all other fields. * unique among all other fields.
*/ */
static public function _fieldColumnName(FieldInterface $field, $column) { static public function _fieldColumnName(FieldConfigInterface $field, $column) {
return in_array($column, FieldConfig::getReservedColumns()) ? $column : $field->getName() . '_' . $column; return in_array($column, FieldConfig::getReservedColumns()) ? $column : $field->getName() . '_' . $column;
} }

View File

@ -9,8 +9,8 @@ namespace Drupal\Core\Entity;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\Core\Field\PrepareCacheInterface; use Drupal\Core\Field\PrepareCacheInterface;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\Core\Field\ConfigFieldItemListInterface; use Drupal\Core\Field\ConfigFieldItemListInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
@ -295,32 +295,32 @@ abstract class FieldableEntityStorageControllerBase extends EntityStorageControl
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldCreate(FieldInterface $field) { } public function onFieldCreate(FieldConfigInterface $field) { }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldUpdate(FieldInterface $field) { } public function onFieldUpdate(FieldConfigInterface $field) { }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldDelete(FieldInterface $field) { } public function onFieldDelete(FieldConfigInterface $field) { }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onInstanceCreate(FieldInstanceInterface $instance) { } public function onInstanceCreate(FieldInstanceConfigInterface $instance) { }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onInstanceUpdate(FieldInstanceInterface $instance) { } public function onInstanceUpdate(FieldInstanceConfigInterface $instance) { }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onInstanceDelete(FieldInstanceInterface $instance) { } public function onInstanceDelete(FieldInstanceConfigInterface $instance) { }
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -340,7 +340,7 @@ abstract class FieldableEntityStorageControllerBase extends EntityStorageControl
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldItemsPurge(EntityInterface $entity, FieldInstanceInterface $instance) { public function onFieldItemsPurge(EntityInterface $entity, FieldInstanceConfigInterface $instance) {
if ($values = $this->readFieldItemsToPurge($entity, $instance)) { if ($values = $this->readFieldItemsToPurge($entity, $instance)) {
$items = \Drupal::typedDataManager()->create($instance, $values, $instance->getName(), $entity); $items = \Drupal::typedDataManager()->create($instance, $values, $instance->getName(), $entity);
$items->delete(); $items->delete();
@ -356,29 +356,29 @@ abstract class FieldableEntityStorageControllerBase extends EntityStorageControl
* *
* @param \Drupal\Core\Entity\EntityInterface $entity * @param \Drupal\Core\Entity\EntityInterface $entity
* The entity. * The entity.
* @param \Drupal\field\FieldInstanceInterface $instance * @param \Drupal\field\FieldInstanceConfigInterface $instance
* The field instance. * The field instance.
* *
* @return array * @return array
* The field values, in their canonical array format (numerically indexed * The field values, in their canonical array format (numerically indexed
* array of items, each item being a property/value array). * array of items, each item being a property/value array).
*/ */
abstract protected function readFieldItemsToPurge(EntityInterface $entity, FieldInstanceInterface $instance); abstract protected function readFieldItemsToPurge(EntityInterface $entity, FieldInstanceConfigInterface $instance);
/** /**
* Removes field data from storage during purge. * Removes field data from storage during purge.
* *
* @param EntityInterface $entity * @param EntityInterface $entity
* The entity whose values are being purged. * The entity whose values are being purged.
* @param FieldInstanceInterface $instance * @param FieldInstanceConfigInterface $instance
* The field whose values are bing purged. * The field whose values are bing purged.
*/ */
abstract protected function purgeFieldItems(EntityInterface $entity, FieldInstanceInterface $instance); abstract protected function purgeFieldItems(EntityInterface $entity, FieldInstanceConfigInterface $instance);
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldPurge(FieldInterface $field) { } public function onFieldPurge(FieldConfigInterface $field) { }
/** /**
* Checks translation statuses and invoke the related hooks if needed. * Checks translation statuses and invoke the related hooks if needed.

View File

@ -7,26 +7,26 @@
namespace Drupal\Core\Entity; namespace Drupal\Core\Entity;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
interface FieldableEntityStorageControllerInterface extends EntityStorageControllerInterface { interface FieldableEntityStorageControllerInterface extends EntityStorageControllerInterface {
/** /**
* Allows reaction to the creation of a configurable field. * Allows reaction to the creation of a configurable field.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field being created. * The field being created.
*/ */
public function onFieldCreate(FieldInterface $field); public function onFieldCreate(FieldConfigInterface $field);
/** /**
* Allows reaction to the update of a configurable field. * Allows reaction to the update of a configurable field.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field being updated. * The field being updated.
*/ */
public function onFieldUpdate(FieldInterface $field); public function onFieldUpdate(FieldConfigInterface $field);
/** /**
* Allows reaction to the deletion of a configurable field. * Allows reaction to the deletion of a configurable field.
@ -34,28 +34,28 @@ interface FieldableEntityStorageControllerInterface extends EntityStorageControl
* Stored values should not be wiped at once, but marked as 'deleted' so that * Stored values should not be wiped at once, but marked as 'deleted' so that
* they can go through a proper purge process later on. * they can go through a proper purge process later on.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field being deleted. * The field being deleted.
* *
* @see fieldPurgeData() * @see fieldPurgeData()
*/ */
public function onFieldDelete(FieldInterface $field); public function onFieldDelete(FieldConfigInterface $field);
/** /**
* Allows reaction to the creation of a configurable field instance. * Allows reaction to the creation of a configurable field instance.
* *
* @param \Drupal\field\FieldInstanceInterface $instance * @param \Drupal\field\FieldInstanceConfigInterface $instance
* The instance being created. * The instance being created.
*/ */
public function onInstanceCreate(FieldInstanceInterface $instance); public function onInstanceCreate(FieldInstanceConfigInterface $instance);
/** /**
* Allows reaction to the update of a configurable field instance. * Allows reaction to the update of a configurable field instance.
* *
* @param \Drupal\field\FieldInstanceInterface $instance * @param \Drupal\field\FieldInstanceConfigInterface $instance
* The instance being updated. * The instance being updated.
*/ */
public function onInstanceUpdate(FieldInstanceInterface $instance); public function onInstanceUpdate(FieldInstanceConfigInterface $instance);
/** /**
* Allows reaction to the deletion of a configurable field instance. * Allows reaction to the deletion of a configurable field instance.
@ -63,12 +63,12 @@ interface FieldableEntityStorageControllerInterface extends EntityStorageControl
* Stored values should not be wiped at once, but marked as 'deleted' so that * Stored values should not be wiped at once, but marked as 'deleted' so that
* they can go through a proper purge process later on. * they can go through a proper purge process later on.
* *
* @param \Drupal\field\FieldInstanceInterface $instance * @param \Drupal\field\FieldInstanceConfigInterface $instance
* The instance being deleted. * The instance being deleted.
* *
* @see fieldPurgeData() * @see fieldPurgeData()
*/ */
public function onInstanceDelete(FieldInstanceInterface $instance); public function onInstanceDelete(FieldInstanceConfigInterface $instance);
/** /**
* Allows reaction to a bundle being created. * Allows reaction to a bundle being created.
@ -109,17 +109,17 @@ interface FieldableEntityStorageControllerInterface extends EntityStorageControl
* *
* @param \Drupal\Core\Entity\EntityInterface $entity * @param \Drupal\Core\Entity\EntityInterface $entity
* The entity whose field data is being purged. * The entity whose field data is being purged.
* @param \Drupal\field\FieldInstanceInterface $instance * @param \Drupal\field\FieldInstanceConfigInterface $instance
* The deleted field instance whose data is being purged. * The deleted field instance whose data is being purged.
*/ */
public function onFieldItemsPurge(EntityInterface $entity, FieldInstanceInterface $instance); public function onFieldItemsPurge(EntityInterface $entity, FieldInstanceConfigInterface $instance);
/** /**
* Performs final cleanup after all data on all instances has been purged. * Performs final cleanup after all data on all instances has been purged.
* *
* @param \Drupal\field\FieldInterface $instance * @param \Drupal\field\FieldConfigInterface $instance
* The field being purged. * The field being purged.
*/ */
public function onFieldPurge(FieldInterface $field); public function onFieldPurge(FieldConfigInterface $field);
} }

View File

@ -8,7 +8,7 @@
namespace Drupal\Core\Entity; namespace Drupal\Core\Entity;
use Drupal\Core\Entity\Query\QueryException; use Drupal\Core\Entity\Query\QueryException;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
/** /**
* Defines a null entity controller class. * Defines a null entity controller class.
@ -97,13 +97,13 @@ class FieldableNullStorageController extends FieldableEntityStorageControllerBas
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function readFieldItemsToPurge(EntityInterface $entity, FieldInstanceInterface $instance) { protected function readFieldItemsToPurge(EntityInterface $entity, FieldInstanceConfigInterface $instance) {
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function purgeFieldItems(EntityInterface $entity, FieldInstanceInterface $instance) { protected function purgeFieldItems(EntityInterface $entity, FieldInstanceConfigInterface $instance) {
} }
} }

View File

@ -7,7 +7,7 @@
namespace Drupal\Core\Field; namespace Drupal\Core\Field;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\field\Field; use Drupal\field\Field;
@ -19,7 +19,7 @@ class ConfigFieldItemList extends FieldItemList implements ConfigFieldItemListIn
/** /**
* The Field instance definition. * The Field instance definition.
* *
* @var \Drupal\field\FieldInstanceInterface * @var \Drupal\field\FieldInstanceConfigInterface
*/ */
protected $instance; protected $instance;
@ -29,7 +29,7 @@ class ConfigFieldItemList extends FieldItemList implements ConfigFieldItemListIn
public function __construct($definition, $name = NULL, TypedDataInterface $parent = NULL) { public function __construct($definition, $name = NULL, TypedDataInterface $parent = NULL) {
parent::__construct($definition, $name, $parent); parent::__construct($definition, $name, $parent);
// Definition can be the field config or field instance. // Definition can be the field config or field instance.
if ($definition instanceof FieldInstanceInterface) { if ($definition instanceof FieldInstanceConfigInterface) {
$this->instance = $definition; $this->instance = $definition;
} }
} }

View File

@ -300,7 +300,7 @@ interface FieldDefinitionInterface extends ListDefinitionInterface {
* The array of field columns, keyed by column name, in the same format * The array of field columns, keyed by column name, in the same format
* returned by getSchema(). * returned by getSchema().
* *
* @see \Drupal\field\Entity\FieldInterface::getSchema() * @see \Drupal\Core\Field\FieldDefinitionInterface::getSchema()
*/ */
public function getColumns(); public function getColumns();

View File

@ -14,8 +14,8 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityChangedInterface; use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\comment\CommentInterface; use Drupal\comment\CommentInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\file\FileInterface; use Drupal\file\FileInterface;
use Drupal\user\EntityOwnerInterface; use Drupal\user\EntityOwnerInterface;
@ -238,7 +238,7 @@ function comment_count_unpublished() {
/** /**
* Implements hook_ENTITY_TYPE_insert() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_insert() for 'field_instance_config'.
*/ */
function comment_field_instance_config_insert(FieldInstanceInterface $instance) { function comment_field_instance_config_insert(FieldInstanceConfigInterface $instance) {
if ($instance->getType() == 'comment' && !$instance->isSyncing()) { if ($instance->getType() == 'comment' && !$instance->isSyncing()) {
\Drupal::service('comment.manager')->addBodyField($instance->entity_type, $instance->getName()); \Drupal::service('comment.manager')->addBodyField($instance->entity_type, $instance->getName());
\Drupal::cache()->delete('comment_entity_info'); \Drupal::cache()->delete('comment_entity_info');
@ -248,7 +248,7 @@ function comment_field_instance_config_insert(FieldInstanceInterface $instance)
/** /**
* Implements hook_ENTITY_TYPE_create() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_create() for 'field_instance_config'.
*/ */
function comment_field_instance_config_create(FieldInstanceInterface $instance) { function comment_field_instance_config_create(FieldInstanceConfigInterface $instance) {
if ($instance->getType() == 'comment' && !$instance->isSyncing()) { if ($instance->getType() == 'comment' && !$instance->isSyncing()) {
// Assign default values for the field instance. // Assign default values for the field instance.
if (!isset($instance->default_value)) { if (!isset($instance->default_value)) {
@ -269,7 +269,7 @@ function comment_field_instance_config_create(FieldInstanceInterface $instance)
/** /**
* Implements hook_ENTITY_TYPE_update() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_update() for 'field_instance_config'.
*/ */
function comment_field_instance_config_update(FieldInstanceInterface $instance) { function comment_field_instance_config_update(FieldInstanceConfigInterface $instance) {
if ($instance->getType() == 'comment') { if ($instance->getType() == 'comment') {
\Drupal::entityManager()->getViewBuilder($instance->entity_type)->resetCache(); \Drupal::entityManager()->getViewBuilder($instance->entity_type)->resetCache();
// Comment field settings also affects the rendering of *comment* entities, // Comment field settings also affects the rendering of *comment* entities,
@ -281,7 +281,7 @@ function comment_field_instance_config_update(FieldInstanceInterface $instance)
/** /**
* Implements hook_ENTITY_TYPE_delete() for 'field_config'. * Implements hook_ENTITY_TYPE_delete() for 'field_config'.
*/ */
function comment_field_config_delete(FieldInterface $field) { function comment_field_config_delete(FieldConfigInterface $field) {
if ($field->getType() == 'comment') { if ($field->getType() == 'comment') {
// Delete all fields and displays attached to the comment bundle. // Delete all fields and displays attached to the comment bundle.
entity_invoke_bundle_hook('delete', 'comment', $field->getName()); entity_invoke_bundle_hook('delete', 'comment', $field->getName());
@ -292,7 +292,7 @@ function comment_field_config_delete(FieldInterface $field) {
/** /**
* Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'.
*/ */
function comment_field_instance_config_delete(FieldInstanceInterface $instance) { function comment_field_instance_config_delete(FieldInstanceConfigInterface $instance) {
if ($instance->getType() == 'comment') { if ($instance->getType() == 'comment') {
// Delete all comments that used by the entity bundle. // Delete all comments that used by the entity bundle.
$comments = db_query("SELECT cid FROM {comment} WHERE entity_type = :entity_type AND field_id = :field_id", array( $comments = db_query("SELECT cid FROM {comment} WHERE entity_type = :entity_type AND field_id = :field_id", array(

View File

@ -21,7 +21,7 @@ class ConfigFieldInstanceMapper extends ConfigEntityMapper {
/** /**
* Loaded entity instance to help produce the translation interface. * Loaded entity instance to help produce the translation interface.
* *
* @var \Drupal\field\FieldInstanceInterface * @var \Drupal\field\FieldInstanceConfigInterface
*/ */
protected $entity; protected $entity;

View File

@ -12,7 +12,7 @@ use Symfony\Component\Routing\Route;
use Drupal\Core\Access\AccessCheckInterface; use Drupal\Core\Access\AccessCheckInterface;
use Drupal\edit\Access\EditEntityFieldAccessCheck; use Drupal\edit\Access\EditEntityFieldAccessCheck;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
@ -110,14 +110,14 @@ class EditEntityFieldAccessCheckTest extends UnitTestCase {
* *
* @param \Drupal\Core\Entity\EntityInterface $entity * @param \Drupal\Core\Entity\EntityInterface $entity
* A mocked entity. * A mocked entity.
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* A mocked field. * A mocked field.
* @param bool|null $expected_result * @param bool|null $expected_result
* The expected result of the access call. * The expected result of the access call.
* *
* @dataProvider providerTestAccess * @dataProvider providerTestAccess
*/ */
public function testAccess(EntityInterface $entity, FieldInterface $field = NULL, $expected_result) { public function testAccess(EntityInterface $entity, FieldConfigInterface $field = NULL, $expected_result) {
$route = new Route('/edit/form/test_entity/1/body/und/full', array(), array('_access_edit_entity_field' => 'TRUE')); $route = new Route('/edit/form/test_entity/1/body/und/full', array(), array('_access_edit_entity_field' => 'TRUE'));
$request = new Request(); $request = new Request();

View File

@ -9,7 +9,7 @@ use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Implements hook_help(). * Implements hook_help().
@ -68,7 +68,7 @@ function entity_reference_field_widget_info_alter(&$info) {
* *
* Reset the instance handler settings, when the target type is changed. * Reset the instance handler settings, when the target type is changed.
*/ */
function entity_reference_field_config_update(FieldInterface $field) { function entity_reference_field_config_update(FieldConfigInterface $field) {
if ($field->type != 'entity_reference') { if ($field->type != 'entity_reference') {
// Only act on entity reference fields. // Only act on entity reference fields.
return; return;

View File

@ -52,7 +52,7 @@ function field_info_field_map() {
* non-deleted field. For deleted fields, use field_info_field_by_id(). * non-deleted field. For deleted fields, use field_info_field_by_id().
* *
* @return * @return
* The \Drupal\field\FieldInterface field definition, as returned by * The \Drupal\field\FieldConfigInterface field definition, as returned by
* entity_load_multiple_by_properties(), NULL if the field was not found. * entity_load_multiple_by_properties(), NULL if the field was not found.
* *
* @see field_info_field_by_id() * @see field_info_field_by_id()
@ -71,7 +71,7 @@ function field_info_field($entity_type, $field_name) {
* The ID of the field to retrieve. $field_id can refer to a deleted field. * The ID of the field to retrieve. $field_id can refer to a deleted field.
* *
* @return * @return
* The \Drupal\field\FieldInterface field definition, as returned by * The \Drupal\field\FieldConfigInterface field definition, as returned by
* entity_load_multiple_by_properties(), NULL if the field was not found. * entity_load_multiple_by_properties(), NULL if the field was not found.
* *
* @see field_info_field() * @see field_info_field()
@ -93,8 +93,8 @@ function field_info_field_by_id($field_id) {
* field_info_instances($entity_type, $bundle), it is recommended to use the * field_info_instances($entity_type, $bundle), it is recommended to use the
* getField() method on each $instance instead. * getField() method on each $instance instead.
* *
* @return \Drupal\field\FieldInterface[] * @return \Drupal\field\FieldConfigInterface[]
* An array of FieldInterface configuration entities, keyed by UUID. * An array of FieldConfigInterface configuration entities, keyed by UUID.
* *
* @see field_info_field() * @see field_info_field()
* @see field_info_field_by_id() * @see field_info_field_by_id()

View File

@ -8,7 +8,7 @@
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\FieldableDatabaseStorageController; use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Implements hook_views_data(). * Implements hook_views_data().
@ -59,13 +59,13 @@ function field_views_data_alter(&$data) {
/** /**
* Determines whether the entity type the field appears in is SQL based. * Determines whether the entity type the field appears in is SQL based.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field definition. * The field definition.
* *
* @return bool * @return bool
* True if the entity type uses DatabaseStorageController. * True if the entity type uses DatabaseStorageController.
*/ */
function _field_views_is_sql_entity_type(FieldInterface $field) { function _field_views_is_sql_entity_type(FieldConfigInterface $field) {
$entity_manager = \Drupal::entityManager(); $entity_manager = \Drupal::entityManager();
if ($entity_manager->getDefinition($field->entity_type) && $entity_manager->getStorageController($field->entity_type) instanceof FieldableDatabaseStorageController) { if ($entity_manager->getDefinition($field->entity_type) && $entity_manager->getStorageController($field->entity_type) instanceof FieldableDatabaseStorageController) {
return TRUE; return TRUE;
@ -102,13 +102,13 @@ function field_views_field_label($entity_type, $field_name) {
/** /**
* Default views data implementation for a field. * Default views data implementation for a field.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field definition. * The field definition.
* *
* @return array * @return array
* The default views data for the field. * The default views data for the field.
*/ */
function field_views_field_default_views_data(FieldInterface $field) { function field_views_field_default_views_data(FieldConfigInterface $field) {
$data = array(); $data = array();
// Check the field type is available. // Check the field type is available.

View File

@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\TypedData\DataDefinition; use Drupal\Core\TypedData\DataDefinition;
use Drupal\field\FieldException; use Drupal\field\FieldException;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Defines the Field entity. * Defines the Field entity.
@ -32,7 +32,7 @@ use Drupal\field\FieldInterface;
* } * }
* ) * )
*/ */
class FieldConfig extends ConfigEntityBase implements FieldInterface { class FieldConfig extends ConfigEntityBase implements FieldConfigInterface {
/** /**
* The maximum length of the field name, in characters. * The maximum length of the field name, in characters.

View File

@ -12,7 +12,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\field\FieldException; use Drupal\field\FieldException;
use Drupal\Core\TypedData\DataDefinition; use Drupal\Core\TypedData\DataDefinition;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
/** /**
* Defines the Field instance entity. * Defines the Field instance entity.
@ -31,7 +31,7 @@ use Drupal\field\FieldInstanceInterface;
* } * }
* ) * )
*/ */
class FieldInstanceConfig extends ConfigEntityBase implements FieldInstanceInterface { class FieldInstanceConfig extends ConfigEntityBase implements FieldInstanceConfigInterface {
/** /**
* The instance ID. * The instance ID.

View File

@ -2,7 +2,7 @@
/** /**
* @file * @file
* Contains \Drupal\field\FieldInterface. * Contains \Drupal\field\FieldConfigInterface.
*/ */
namespace Drupal\field; namespace Drupal\field;
@ -13,7 +13,7 @@ use Drupal\Core\Field\FieldDefinitionInterface;
/** /**
* Provides an interface defining a field entity. * Provides an interface defining a field entity.
*/ */
interface FieldInterface extends ConfigEntityInterface, FieldDefinitionInterface { interface FieldConfigInterface extends ConfigEntityInterface, FieldDefinitionInterface {
/** /**
* Returns the list of bundles where the field has instances. * Returns the list of bundles where the field has instances.

View File

@ -70,7 +70,7 @@ class FieldInfo {
/** /**
* List of $field structures keyed by ID. Includes deleted fields. * List of $field structures keyed by ID. Includes deleted fields.
* *
* @var \Drupal\field\FieldInterface[] * @var \Drupal\field\FieldConfigInterface[]
*/ */
protected $fieldsById = array(); protected $fieldsById = array();
@ -215,7 +215,7 @@ class FieldInfo {
/** /**
* Returns all fields, including deleted ones. * Returns all fields, including deleted ones.
* *
* @return \Drupal\field\FieldInterface[] * @return \Drupal\field\FieldConfigInterface[]
* An array of field entities, keyed by field ID. * An array of field entities, keyed by field ID.
*/ */
public function getFields() { public function getFields() {
@ -306,7 +306,7 @@ class FieldInfo {
* @param string $field_name * @param string $field_name
* The field name. * The field name.
* *
* @return \Drupal\field\FieldInterface|null * @return \Drupal\field\FieldConfigInterface|null
* The field definition, or NULL if no field was found. * The field definition, or NULL if no field was found.
*/ */
public function getField($entity_type, $field_name) { public function getField($entity_type, $field_name) {
@ -342,7 +342,7 @@ class FieldInfo {
* @param string $field_id * @param string $field_id
* The field ID. * The field ID.
* *
* @return \Drupal\field\FieldInterface|null * @return \Drupal\field\FieldConfigInterface|null
* The field entity, or NULL if no field was found. * The field entity, or NULL if no field was found.
*/ */
public function getFieldById($field_id) { public function getFieldById($field_id) {
@ -386,7 +386,7 @@ class FieldInfo {
* @param string $bundle * @param string $bundle
* The bundle name. * The bundle name.
* *
* @return \Drupal\field\FieldInstanceInterface[] * @return \Drupal\field\FieldInstanceConfigInterface[]
* An array of field instance entities, keyed by field name. * An array of field instance entities, keyed by field name.
*/ */
public function getBundleInstances($entity_type, $bundle) { public function getBundleInstances($entity_type, $bundle) {
@ -500,7 +500,7 @@ class FieldInfo {
* @param string $field_name * @param string $field_name
* The field name for the instance. * The field name for the instance.
* *
* @return \Drupal\field\FieldInstanceInterface|null * @return \Drupal\field\FieldInstanceConfigInterface|null
* The field instance entity, or NULL if it does not exist. * The field instance entity, or NULL if it does not exist.
*/ */
function getInstance($entity_type, $bundle, $field_name) { function getInstance($entity_type, $bundle, $field_name) {
@ -551,13 +551,13 @@ class FieldInfo {
/** /**
* Prepares a field for the current run-time context. * Prepares a field for the current run-time context.
* *
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field entity to update. * The field entity to update.
* *
* @return \Drupal\field\FieldInterface * @return \Drupal\field\FieldConfigInterface
* The field that was prepared. * The field that was prepared.
*/ */
public function prepareField(FieldInterface $field) { public function prepareField(FieldConfigInterface $field) {
// Make sure all expected field settings are present. // Make sure all expected field settings are present.
$field->settings += $this->fieldTypeManager->getDefaultSettings($field->getType()); $field->settings += $this->fieldTypeManager->getDefaultSettings($field->getType());
@ -567,13 +567,13 @@ class FieldInfo {
/** /**
* Prepares a field instance for the current run-time context. * Prepares a field instance for the current run-time context.
* *
* @param \Drupal\field\FieldInstanceInterface $instance * @param \Drupal\field\FieldInstanceConfigInterface $instance
* The field instance entity to prepare. * The field instance entity to prepare.
* *
* @return \Drupal\field\FieldInstanceInterface * @return \Drupal\field\FieldInstanceConfigInterface
* The field instance that was prepared. * The field instance that was prepared.
*/ */
public function prepareInstance(FieldInstanceInterface $instance) { public function prepareInstance(FieldInstanceConfigInterface $instance) {
// Make sure all expected instance settings are present. // Make sure all expected instance settings are present.
$instance->settings += $this->fieldTypeManager->getDefaultInstanceSettings($instance->getType()); $instance->settings += $this->fieldTypeManager->getDefaultInstanceSettings($instance->getType());

View File

@ -2,7 +2,7 @@
/** /**
* @file * @file
* Contains \Drupal\field\FieldInstanceInterface. * Contains \Drupal\field\FieldInstanceConfigInterface.
*/ */
namespace Drupal\field; namespace Drupal\field;
@ -13,12 +13,12 @@ use Drupal\Core\Field\FieldDefinitionInterface;
/** /**
* Provides an interface defining a field instance entity. * Provides an interface defining a field instance entity.
*/ */
interface FieldInstanceInterface extends ConfigEntityInterface, FieldDefinitionInterface { interface FieldInstanceConfigInterface extends ConfigEntityInterface, FieldDefinitionInterface {
/** /**
* Returns the field entity for this instance. * Returns the field entity for this instance.
* *
* @return \Drupal\field\FieldInterface * @return \Drupal\field\FieldConfigInterface
* The field entity for this instance. * The field entity for this instance.
*/ */
public function getField(); public function getField();

View File

@ -43,7 +43,7 @@ class Field extends FieldPluginBase {
/** /**
* The field information as returned by field_info_field(). * The field information as returned by field_info_field().
* *
* @var \Drupal\field\FieldInterface * @var \Drupal\field\FieldConfigInterface
*/ */
public $field_info; public $field_info;

View File

@ -9,7 +9,7 @@ namespace Drupal\field\Tests;
use Drupal\Core\Entity\FieldableDatabaseStorageController; use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**

View File

@ -1,7 +1,7 @@
<?php <?php
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* @file * @file
@ -106,7 +106,7 @@ function field_test_memorize($key = NULL, $value = NULL) {
/** /**
* Memorize calls to field_test_field_config_create() for field creation. * Memorize calls to field_test_field_config_create() for field creation.
*/ */
function field_test_field_config_create(FieldInterface $field) { function field_test_field_config_create(FieldConfigInterface $field) {
$args = func_get_args(); $args = func_get_args();
field_test_memorize(__FUNCTION__, $args); field_test_memorize(__FUNCTION__, $args);
} }

View File

@ -11,7 +11,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Drupal\Core\TypedData\TypedDataManager; use Drupal\Core\TypedData\TypedDataManager;
use Drupal\field\FieldInfo; use Drupal\field\FieldInfo;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field_ui\FieldUI; use Drupal\field_ui\FieldUI;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
@ -23,7 +23,7 @@ class FieldEditForm extends FormBase {
/** /**
* The field instance being edited. * The field instance being edited.
* *
* @var \Drupal\field\FieldInstanceInterface * @var \Drupal\field\FieldInstanceConfigInterface
*/ */
protected $instance; protected $instance;
@ -85,7 +85,7 @@ class FieldEditForm extends FormBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildForm(array $form, array &$form_state, FieldInstanceInterface $field_instance_config = NULL) { public function buildForm(array $form, array &$form_state, FieldInstanceConfigInterface $field_instance_config = NULL) {
$this->instance = $form_state['instance'] = $field_instance_config; $this->instance = $form_state['instance'] = $field_instance_config;
$form['#title'] = $this->instance->label(); $form['#title'] = $this->instance->label();
@ -125,13 +125,13 @@ class FieldEditForm extends FormBase {
'#title_display' => 'invisible', '#title_display' => 'invisible',
'#options' => array( '#options' => array(
'number' => $this->t('Limited'), 'number' => $this->t('Limited'),
FieldInstanceInterface::CARDINALITY_UNLIMITED => $this->t('Unlimited'), FieldInstanceConfigInterface::CARDINALITY_UNLIMITED => $this->t('Unlimited'),
), ),
'#default_value' => ($cardinality == FieldInstanceInterface::CARDINALITY_UNLIMITED) ? FieldInstanceInterface::CARDINALITY_UNLIMITED : 'number', '#default_value' => ($cardinality == FieldInstanceConfigInterface::CARDINALITY_UNLIMITED) ? FieldInstanceConfigInterface::CARDINALITY_UNLIMITED : 'number',
); );
$form['field']['cardinality_container']['cardinality_number'] = array( $form['field']['cardinality_container']['cardinality_number'] = array(
'#type' => 'number', '#type' => 'number',
'#default_value' => $cardinality != FieldInstanceInterface::CARDINALITY_UNLIMITED ? $cardinality : 1, '#default_value' => $cardinality != FieldInstanceConfigInterface::CARDINALITY_UNLIMITED ? $cardinality : 1,
'#min' => 1, '#min' => 1,
'#title' => $this->t('Limit'), '#title' => $this->t('Limit'),
'#title_display' => 'invisible', '#title_display' => 'invisible',

View File

@ -10,7 +10,7 @@ namespace Drupal\field_ui\Form;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Drupal\Component\Utility\String; use Drupal\Component\Utility\String;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field_ui\FieldUI; use Drupal\field_ui\FieldUI;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
@ -22,7 +22,7 @@ class FieldInstanceEditForm extends FormBase {
/** /**
* The field instance being edited. * The field instance being edited.
* *
* @var \Drupal\field\FieldInstanceInterface * @var \Drupal\field\FieldInstanceConfigInterface
*/ */
protected $instance; protected $instance;
@ -62,7 +62,7 @@ class FieldInstanceEditForm extends FormBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildForm(array $form, array &$form_state, FieldInstanceInterface $field_instance_config = NULL) { public function buildForm(array $form, array &$form_state, FieldInstanceConfigInterface $field_instance_config = NULL) {
$this->instance = $form_state['instance'] = $field_instance_config; $this->instance = $form_state['instance'] = $field_instance_config;
$bundle = $this->instance->bundle; $bundle = $this->instance->bundle;
@ -231,13 +231,13 @@ class FieldInstanceEditForm extends FormBase {
/** /**
* The _title_callback for the field instance settings form. * The _title_callback for the field instance settings form.
* *
* @param \Drupal\field\FieldInstanceInterface $field_instance_config * @param \Drupal\field\FieldInstanceConfigInterface $field_instance_config
* The field instance. * The field instance.
* *
* @return string * @return string
* The label of the field instance. * The label of the field instance.
*/ */
public function getTitle(FieldInstanceInterface $field_instance_config) { public function getTitle(FieldInstanceConfigInterface $field_instance_config) {
return String::checkPlain($field_instance_config->label()); return String::checkPlain($field_instance_config->label());
} }

View File

@ -6,7 +6,7 @@
*/ */
use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Html;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Implements hook_field_info_alter(). * Implements hook_field_info_alter().
@ -223,14 +223,14 @@ function theme_file_upload_help($variables) {
/** /**
* Determine whether a field references files stored in {file_managed}. * Determine whether a field references files stored in {file_managed}.
* *
* @param Drupal\field\FieldInterface $field * @param Drupal\field\FieldConfigInterface $field
* A field definition. * A field definition.
* *
* @return * @return
* The field column if the field references {file_managed}.fid, typically * The field column if the field references {file_managed}.fid, typically
* fid, FALSE if it doesn't. * fid, FALSE if it doesn't.
*/ */
function file_field_find_file_reference_column(FieldInterface $field) { function file_field_find_file_reference_column(FieldConfigInterface $field) {
$schema = $field->getSchema(); $schema = $field->getSchema();
foreach ($schema['foreign keys'] as $data) { foreach ($schema['foreign keys'] as $data) {
if ($data['table'] == 'file_managed') { if ($data['table'] == 'file_managed') {

View File

@ -6,7 +6,7 @@
*/ */
use Drupal\Core\Entity\FieldableDatabaseStorageController; use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Implements hook_views_data(). * Implements hook_views_data().
@ -480,7 +480,7 @@ function file_views_data() {
* *
* @see field_views_field_default_views_data() * @see field_views_field_default_views_data()
*/ */
function file_field_views_data(FieldInterface $field) { function file_field_views_data(FieldConfigInterface $field) {
$data = field_views_field_default_views_data($field); $data = field_views_field_default_views_data($field);
foreach ($data as $table_name => $table_data) { foreach ($data as $table_name => $table_data) {
// Add the relationship only on the fid field. // Add the relationship only on the fid field.
@ -501,7 +501,7 @@ function file_field_views_data(FieldInterface $field) {
* *
* Views integration to provide reverse relationships on file fields. * Views integration to provide reverse relationships on file fields.
*/ */
function file_field_views_data_views_data_alter(array &$data, FieldInterface $field) { function file_field_views_data_views_data_alter(array &$data, FieldConfigInterface $field) {
$entity_type_id = $field->entity_type; $entity_type_id = $field->entity_type;
$entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
$field_name = $field->getName(); $field_name = $field->getName();

View File

@ -7,7 +7,7 @@
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\file\Entity\File; use Drupal\file\Entity\File;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Form constructor for testing a 'managed_file' element. * Form constructor for testing a 'managed_file' element.
@ -74,7 +74,7 @@ function file_module_test_form_submit($form, &$form_state) {
/** /**
* Implements hook_file_download_access(). * Implements hook_file_download_access().
*/ */
function file_module_test_file_download_access(FieldInterface $field, EntityInterface $entity, File $file) { function file_module_test_file_download_access(FieldConfigInterface $field, EntityInterface $entity, File $file) {
$instance = field_info_instance($entity->getEntityTypeId(), $field->getName(), $entity->bundle()); $instance = field_info_instance($entity->getEntityTypeId(), $field->getName(), $entity->bundle());
// Allow the file to be downloaded only if the given arguments are correct. // Allow the file to be downloaded only if the given arguments are correct.
// If any are wrong, $instance will be NULL. // If any are wrong, $instance will be NULL.

View File

@ -10,8 +10,8 @@ use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldInstanceConfig; use Drupal\field\Entity\FieldInstanceConfig;
use Drupal\file\Entity\File; use Drupal\file\Entity\File;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
/** /**
* Image style constant for user presets in the database. * Image style constant for user presets in the database.
@ -457,7 +457,7 @@ function image_entity_presave(EntityInterface $entity) {
/** /**
* Implements hook_ENTITY_TYPE_update() for 'field_config'. * Implements hook_ENTITY_TYPE_update() for 'field_config'.
*/ */
function image_field_config_update(FieldInterface $field) { function image_field_config_update(FieldConfigInterface $field) {
if ($field->type != 'image') { if ($field->type != 'image') {
// Only act on image fields. // Only act on image fields.
return; return;
@ -497,7 +497,7 @@ function image_field_config_update(FieldInterface $field) {
/** /**
* Implements hook_ENTITY_TYPE_update() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_update() for 'field_instance_config'.
*/ */
function image_field_instance_config_update(FieldInstanceInterface $field_instance) { function image_field_instance_config_update(FieldInstanceConfigInterface $field_instance) {
$field = $field_instance->getField(); $field = $field_instance->getField();
if ($field->type != 'image') { if ($field->type != 'image') {
// Only act on image fields. // Only act on image fields.
@ -535,7 +535,7 @@ function image_field_instance_config_update(FieldInstanceInterface $field_instan
/** /**
* Implements hook_ENTITY_TYPE_delete() for 'field_config'. * Implements hook_ENTITY_TYPE_delete() for 'field_config'.
*/ */
function image_field_config_delete(FieldInterface $field) { function image_field_config_delete(FieldConfigInterface $field) {
if ($field->type != 'image') { if ($field->type != 'image') {
// Only act on image fields. // Only act on image fields.
return; return;
@ -551,7 +551,7 @@ function image_field_config_delete(FieldInterface $field) {
/** /**
* Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'.
*/ */
function image_field_instance_config_delete(FieldInstanceInterface $field_instance) { function image_field_instance_config_delete(FieldInstanceConfigInterface $field_instance) {
$field = $field_instance->getField(); $field = $field_instance->getField();
if ($field->type != 'image') { if ($field->type != 'image') {
// Only act on image fields. // Only act on image fields.

View File

@ -6,7 +6,7 @@
*/ */
use Drupal\Core\Entity\FieldableDatabaseStorageController; use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Implements hook_field_views_data(). * Implements hook_field_views_data().
@ -16,7 +16,7 @@ use Drupal\field\FieldInterface;
* *
* @see field_views_field_default_views_data() * @see field_views_field_default_views_data()
*/ */
function image_field_views_data(FieldInterface $field) { function image_field_views_data(FieldConfigInterface $field) {
$data = field_views_field_default_views_data($field); $data = field_views_field_default_views_data($field);
foreach ($data as $table_name => $table_data) { foreach ($data as $table_name => $table_data) {
// Add the relationship only on the target_id field. // Add the relationship only on the target_id field.
@ -36,7 +36,7 @@ function image_field_views_data(FieldInterface $field) {
* *
* Views integration to provide reverse relationships on image fields. * Views integration to provide reverse relationships on image fields.
*/ */
function image_field_views_data_views_data_alter(array &$data, FieldInterface $field) { function image_field_views_data_views_data_alter(array &$data, FieldConfigInterface $field) {
$entity_type_id = $field->entity_type; $entity_type_id = $field->entity_type;
$field_name = $field->getName(); $field_name = $field->getName();
$entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);

View File

@ -7,7 +7,7 @@
namespace Drupal\image\Plugin\Field\FieldFormatter; namespace Drupal\image\Plugin\Field\FieldFormatter;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase; use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase;
/** /**
@ -28,7 +28,7 @@ abstract class ImageFormatterBase extends FileFormatterBase {
$default_image = $this->getFieldSetting('default_image'); $default_image = $this->getFieldSetting('default_image');
// If we are dealing with a configurable field, look in both // If we are dealing with a configurable field, look in both
// instance-level and field-level settings. // instance-level and field-level settings.
if (empty($default_image['fid']) && $this->fieldDefinition instanceof FieldInstanceInterface) { if (empty($default_image['fid']) && $this->fieldDefinition instanceof FieldInstanceConfigInterface) {
$default_image = $this->fieldDefinition->getField()->getSetting('default_image'); $default_image = $this->fieldDefinition->getField()->getSetting('default_image');
} }

View File

@ -8,7 +8,7 @@
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldUpdateForbiddenException; use Drupal\field\FieldUpdateForbiddenException;
/** /**
@ -45,14 +45,14 @@ function options_field_settings_form_value_boolean_allowed_values($element, $inp
/** /**
* Implements hook_ENTITY_TYPE_update() for 'field_config'. * Implements hook_ENTITY_TYPE_update() for 'field_config'.
*/ */
function options_field_config_update(FieldInterface $field) { function options_field_config_update(FieldConfigInterface $field) {
drupal_static_reset('options_allowed_values'); drupal_static_reset('options_allowed_values');
} }
/** /**
* Implements hook_ENTITY_TYPE_delete() for 'field_config'. * Implements hook_ENTITY_TYPE_delete() for 'field_config'.
*/ */
function options_field_config_delete(FieldInterface $field) { function options_field_config_delete(FieldConfigInterface $field) {
drupal_static_reset('options_allowed_values'); drupal_static_reset('options_allowed_values');
} }

View File

@ -10,8 +10,8 @@ use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
use Drupal\entity\Entity\EntityFormDisplay; use Drupal\entity\Entity\EntityFormDisplay;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
/** /**
* Filter that limits test entity list to revisable ones. * Filter that limits test entity list to revisable ones.
@ -494,14 +494,14 @@ function entity_test_entity_test_mul_translation_delete(EntityInterface $transla
* *
* @param \Drupal\Core\Entity\EntityInterface $entity * @param \Drupal\Core\Entity\EntityInterface $entity
* The entity the field belongs to. * The entity the field belongs to.
* @param \Drupal\field\FieldInterface $field * @param \Drupal\field\FieldConfigInterface $field
* The field for which default values should be provided. * The field for which default values should be provided.
* @param \Drupal\field\FieldInstanceInterface $instance * @param \Drupal\field\FieldInstanceConfigInterface $instance
* The field instance for which default values should be provided. * The field instance for which default values should be provided.
* @param string $langcode * @param string $langcode
* The field language code to fill-in with the default value. * The field language code to fill-in with the default value.
*/ */
function entity_test_field_default_value(EntityInterface $entity, FieldInterface $field, FieldInstanceInterface $instance, $langcode) { function entity_test_field_default_value(EntityInterface $entity, FieldConfigInterface $field, FieldInstanceConfigInterface $instance, $langcode) {
return array(array('value' => $field->getName() . '_' . $langcode)); return array(array('value' => $field->getName() . '_' . $langcode));
} }

View File

@ -6,7 +6,7 @@
*/ */
use Drupal\Core\Entity\FieldableDatabaseStorageController; use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\field\FieldInterface; use Drupal\field\FieldConfigInterface;
/** /**
* Implements hook_views_data(). * Implements hook_views_data().
@ -404,7 +404,7 @@ function taxonomy_views_data_alter(&$data) {
* *
* @see field_views_field_default_views_data() * @see field_views_field_default_views_data()
*/ */
function taxonomy_field_views_data(FieldInterface $field) { function taxonomy_field_views_data(FieldConfigInterface $field) {
$data = field_views_field_default_views_data($field); $data = field_views_field_default_views_data($field);
foreach ($data as $table_name => $table_data) { foreach ($data as $table_name => $table_data) {
foreach ($table_data as $field_name => $field_data) { foreach ($table_data as $field_name => $field_data) {
@ -434,7 +434,7 @@ function taxonomy_field_views_data(FieldInterface $field) {
* *
* Views integration to provide reverse relationships on term references. * Views integration to provide reverse relationships on term references.
*/ */
function taxonomy_field_views_data_views_data_alter(array &$data, FieldInterface $field) { function taxonomy_field_views_data_views_data_alter(array &$data, FieldConfigInterface $field) {
$field_name = $field->getName(); $field_name = $field->getName();
$entity_type_id = $field->entity_type; $entity_type_id = $field->entity_type;
$entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);

View File

@ -18,7 +18,7 @@ use Drupal\views\ViewExecutable;
use Drupal\Component\Plugin\Exception\PluginException; use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\views\Entity\View; use Drupal\views\Entity\View;
use Drupal\views\Views; use Drupal\views\Views;
use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInstanceConfigInterface;
/** /**
* Implements hook_help(). * Implements hook_help().
@ -536,7 +536,7 @@ function views_language_list($field = 'name', $flags = Language::STATE_ALL) {
/** /**
* Implements hook_ENTITY_TYPE_create() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_create() for 'field_instance_config'.
*/ */
function views_field_instance_config_create(FieldInstanceInterface $field_instance) { function views_field_instance_config_create(FieldInstanceConfigInterface $field_instance) {
\Drupal::cache('views_info')->deleteAll(); \Drupal::cache('views_info')->deleteAll();
\Drupal::cache('views_results')->deleteAll(); \Drupal::cache('views_results')->deleteAll();
} }
@ -544,7 +544,7 @@ function views_field_instance_config_create(FieldInstanceInterface $field_instan
/** /**
* Implements hook_ENTITY_TYPE_update() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_update() for 'field_instance_config'.
*/ */
function views_field_instance_config_update(FieldInstanceInterface $field_instance) { function views_field_instance_config_update(FieldInstanceConfigInterface $field_instance) {
\Drupal::cache('views_info')->deleteAll(); \Drupal::cache('views_info')->deleteAll();
\Drupal::cache('views_results')->deleteAll(); \Drupal::cache('views_results')->deleteAll();
} }
@ -552,7 +552,7 @@ function views_field_instance_config_update(FieldInstanceInterface $field_instan
/** /**
* Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'. * Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'.
*/ */
function views_field_instance_config_delete(FieldInstanceInterface $field_instance) { function views_field_instance_config_delete(FieldInstanceConfigInterface $field_instance) {
\Drupal::cache('views_info')->deleteAll(); \Drupal::cache('views_info')->deleteAll();
\Drupal::cache('views_results')->deleteAll(); \Drupal::cache('views_results')->deleteAll();
} }

View File

@ -82,7 +82,7 @@ class FieldableDatabaseStorageControllerTest extends UnitTestCase {
->will($this->returnValue($fields)); ->will($this->returnValue($fields));
// Define a field definition for a test_field field. // Define a field definition for a test_field field.
$field = $this->getMock('\Drupal\field\FieldInterface'); $field = $this->getMock('\Drupal\field\FieldConfigInterface');
$field->deleted = FALSE; $field->deleted = FALSE;
$field->entity_type = 'test_entity'; $field->entity_type = 'test_entity';
$field->name = 'test_field'; $field->name = 'test_field';