Commit 8fe81428 authored by alexpott's avatar alexpott

Issue #2315237 by andypost, daggerhart | yched: Rename FieldDefinition to BaseFieldDefinition.

parent 426a531e
......@@ -44,11 +44,11 @@ public function initTranslation($langcode);
/**
* Provides base field definitions for an entity type.
*
* Implementations typically use the class \Drupal\Core\Field\FieldDefinition
* Implementations typically use the class \Drupal\Core\Field\BaseFieldDefinition
* for creating the field definitions; for example a 'name' field could be
* defined as the following:
* @code
* $fields['name'] = FieldDefinition::create('string')
* $fields['name'] = BaseFieldDefinition::create('string')
* ->setLabel(t('Name'));
* @endcode
*
......
......@@ -11,7 +11,7 @@
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Component\Utility\String;
use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
......@@ -76,7 +76,7 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa
* Static cache of field storage definitions per entity type.
*
* Elements of the array:
* - $entity_type_id: \Drupal\Core\Field\FieldDefinition[]
* - $entity_type_id: \Drupal\Core\Field\BaseFieldDefinition[]
*
* @var array
*/
......@@ -382,7 +382,7 @@ protected function buildBaseFieldDefinitions($entity_type_id) {
foreach ($base_field_definitions as $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a proper
// provider setter. See https://drupal.org/node/2225961.
if ($definition instanceof FieldDefinition) {
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($provider);
}
}
......@@ -396,7 +396,7 @@ protected function buildBaseFieldDefinitions($entity_type_id) {
foreach ($module_definitions as $field_name => $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a
// proper provider setter. See https://drupal.org/node/2225961.
if ($definition instanceof FieldDefinition && $definition->getProvider() == NULL) {
if ($definition instanceof BaseFieldDefinition && $definition->getProvider() == NULL) {
$definition->setProvider($module);
}
$base_field_definitions[$field_name] = $definition;
......@@ -407,7 +407,7 @@ protected function buildBaseFieldDefinitions($entity_type_id) {
// Automatically set the field name, target entity type and bundle
// for non-configurable fields.
foreach ($base_field_definitions as $field_name => $base_field_definition) {
if ($base_field_definition instanceof FieldDefinition) {
if ($base_field_definition instanceof BaseFieldDefinition) {
$base_field_definition->setName($field_name);
$base_field_definition->setTargetEntityTypeId($entity_type_id);
$base_field_definition->setBundle(NULL);
......@@ -481,7 +481,7 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $
foreach ($bundle_field_definitions as $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a proper
// provider setter. See https://drupal.org/node/2225961.
if ($definition instanceof FieldDefinition) {
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($provider);
}
}
......@@ -495,7 +495,7 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $
foreach ($module_definitions as $field_name => $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a
// proper provider setter. See https://drupal.org/node/2225961.
if ($definition instanceof FieldDefinition) {
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($module);
}
$bundle_field_definitions[$field_name] = $definition;
......@@ -506,7 +506,7 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $
// Automatically set the field name, target entity type and bundle
// for non-configurable fields.
foreach ($bundle_field_definitions as $field_name => $field_definition) {
if ($field_definition instanceof FieldDefinition) {
if ($field_definition instanceof BaseFieldDefinition) {
$field_definition->setName($field_name);
$field_definition->setTargetEntityTypeId($entity_type_id);
$field_definition->setBundle($bundle);
......@@ -617,7 +617,7 @@ protected function buildFieldStorageDefinitions($entity_type_id) {
foreach ($module_definitions as $field_name => $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a
// proper provider setter. See https://drupal.org/node/2225961.
if ($definition instanceof FieldDefinition) {
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($module);
}
$field_definitions[$field_name] = $definition;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Field\FieldDefinition.
* Contains \Drupal\Core\Field\BaseFieldDefinition.
*/
namespace Drupal\Core\Field;
......@@ -15,7 +15,7 @@
/**
* A class for defining entity fields.
*/
class FieldDefinition extends ListDataDefinition implements FieldDefinitionInterface, FieldStorageDefinitionInterface {
class BaseFieldDefinition extends ListDataDefinition implements FieldDefinitionInterface, FieldStorageDefinitionInterface {
/**
* The field type.
......
......@@ -39,7 +39,7 @@
* However, entity base fields, such as $node->title, are not managed by
* field.module and its "field_storage_config"/"field_instance_config"
* configuration entities. Therefore, their definitions are provided by
* different objects based on the class \Drupal\Core\Field\FieldDefinition,
* different objects based on the class \Drupal\Core\Field\BaseFieldDefinition,
* which implements this interface as well.
*
* Field definitions may fully define a concrete data object (e.g.,
......
......@@ -32,7 +32,7 @@ interface FieldItemInterface extends ComplexDataInterface {
* An array of property definitions of contained properties, keyed by
* property name.
*
* @see \Drupal\Core\Field\FieldDefinition
* @see \Drupal\Core\Field\BaseFieldDefinition
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition);
......@@ -46,7 +46,7 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel
* @return string|null
* The name of the value property, or NULL if there is none.
*
* @see \Drupal\Core\Field\FieldDefinition
* @see \Drupal\Core\Field\BaseFieldDefinition
*/
public static function mainPropertyName();
......
......@@ -78,7 +78,7 @@ public function getDerivativeDefinition($derivative_id, $base_plugin_definition)
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->fieldTypePluginManager->getDefinitions() as $plugin_id => $definition) {
$definition['definition_class'] = '\Drupal\Core\Field\TypedData\FieldItemDataDefinition';
$definition['list_definition_class'] = '\Drupal\Core\Field\FieldDefinition';
$definition['list_definition_class'] = '\Drupal\Core\Field\BaseFieldDefinition';
$this->derivatives[$plugin_id] = $definition;
}
return $this->derivatives;
......
......@@ -7,7 +7,7 @@
namespace Drupal\Core\Field\TypedData;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\TypedData\ComplexDataDefinitionInterface;
use Drupal\Core\TypedData\DataDefinition;
......@@ -38,7 +38,7 @@ public static function createFromDataType($data_type) {
throw new \InvalidArgumentException('Data type must be in the form of "field_item:FIELD_TYPE".');
}
$field_definition = FieldDefinition::create($parts[1]);
$field_definition = BaseFieldDefinition::create($parts[1]);
return $field_definition->getItemDefinition();
}
......
......@@ -9,7 +9,7 @@
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Symfony\Component\DependencyInjection\Container;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\aggregator\FeedInterface;
......@@ -127,18 +127,18 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['fid'] = FieldDefinition::create('integer')
$fields['fid'] = BaseFieldDefinition::create('integer')
->setLabel(t('Feed ID'))
->setDescription(t('The ID of the aggregator feed.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['uuid'] = FieldDefinition::create('uuid')
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The aggregator feed UUID.'))
->setReadOnly(TRUE);
$fields['title'] = FieldDefinition::create('string')
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Title'))
->setDescription(t('The name of the feed (or the name of the website providing the feed).'))
->setRequired(TRUE)
......@@ -148,11 +148,11 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
'weight' => -5,
));
$fields['langcode'] = FieldDefinition::create('language')
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language code'))
->setDescription(t('The feed language code.'));
$fields['url'] = FieldDefinition::create('uri')
$fields['url'] = BaseFieldDefinition::create('uri')
->setLabel(t('URL'))
->setDescription(t('The fully-qualified URL of the feed.'))
->setRequired(TRUE)
......@@ -165,7 +165,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$period = array_map(array(\Drupal::service('date.formatter'), 'formatInterval'), array_combine($intervals, $intervals));
$period[AGGREGATOR_CLEAR_NEVER] = t('Never');
$fields['refresh'] = FieldDefinition::create('list_integer')
$fields['refresh'] = BaseFieldDefinition::create('list_integer')
->setLabel(t('Update interval'))
->setDescription(t('The length of time between feed updates. Requires a correctly configured <a href="@cron">cron maintenance task</a>.', array('@cron' => url('admin/reports/status'))))
->setSetting('unsigned', TRUE)
......@@ -176,39 +176,39 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
'weight' => -2,
));
$fields['checked'] = FieldDefinition::create('timestamp')
$fields['checked'] = BaseFieldDefinition::create('timestamp')
->setLabel(t('Checked'))
->setDescription(t('Last time feed was checked for new items, as Unix timestamp.'))
->setDefaultValue(0);
$fields['queued'] = FieldDefinition::create('timestamp')
$fields['queued'] = BaseFieldDefinition::create('timestamp')
->setLabel(t('Queued'))
->setDescription(t('Time when this feed was queued for refresh, 0 if not queued.'))
->setDefaultValue(0);
$fields['link'] = FieldDefinition::create('uri')
$fields['link'] = BaseFieldDefinition::create('uri')
->setLabel(t('Link'))
->setDescription(t('The link of the feed.'));
$fields['description'] = FieldDefinition::create('string_long')
$fields['description'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Description'))
->setDescription(t("The parent website's description that comes from the !description element in the feed.", array('!description' => '<description>')));
$fields['image'] = FieldDefinition::create('uri')
$fields['image'] = BaseFieldDefinition::create('uri')
->setLabel(t('Image'))
->setDescription(t('An image representing the feed.'));
$fields['hash'] = FieldDefinition::create('string')
$fields['hash'] = BaseFieldDefinition::create('string')
->setLabel(t('Hash'))
->setDescription(t('Calculated hash of the feed data, used for validating cache.'));
$fields['etag'] = FieldDefinition::create('string')
$fields['etag'] = BaseFieldDefinition::create('string')
->setLabel(t('Etag'))
->setDescription(t('Entity tag HTTP response header, used for validating cache.'));
// This is updated by the fetcher and not when the feed is saved, therefore
// it's a timestamp and not a changed field.
$fields['modified'] = FieldDefinition::create('timestamp')
$fields['modified'] = BaseFieldDefinition::create('timestamp')
->setLabel(t('Modified'))
->setDescription(t('When the feed was last modified, as a Unix timestamp.'));
......
......@@ -12,7 +12,7 @@
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\aggregator\ItemInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Url;
/**
......@@ -49,43 +49,43 @@ public function label() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['iid'] = FieldDefinition::create('integer')
$fields['iid'] = BaseFieldDefinition::create('integer')
->setLabel(t('Aggregator item ID'))
->setDescription(t('The ID of the feed item.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['fid'] = FieldDefinition::create('entity_reference')
$fields['fid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Aggregator feed ID'))
->setDescription(t('The ID of the aggregator feed.'))
->setSetting('target_type', 'aggregator_feed');
$fields['title'] = FieldDefinition::create('string')
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Title'))
->setDescription(t('The title of the feed item.'));
$fields['langcode'] = FieldDefinition::create('language')
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language code'))
->setDescription(t('The feed item language code.'));
$fields['link'] = FieldDefinition::create('uri')
$fields['link'] = BaseFieldDefinition::create('uri')
->setLabel(t('Link'))
->setDescription(t('The link of the feed item.'));
$fields['author'] = FieldDefinition::create('string')
$fields['author'] = BaseFieldDefinition::create('string')
->setLabel(t('Author'))
->setDescription(t('The author of the feed item.'));
$fields['description'] = FieldDefinition::create('string_long')
$fields['description'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Description'))
->setDescription(t('The body of the feed item.'));
$fields['timestamp'] = FieldDefinition::create('created')
$fields['timestamp'] = BaseFieldDefinition::create('created')
->setLabel(t('Posted timestamp'))
->setDescription(t('Posted date of the feed item, as a Unix timestamp.'));
// @todo Convert to a real UUID field in https://drupal.org/node/2149851.
$fields['guid'] = FieldDefinition::create('string_long')
$fields['guid'] = BaseFieldDefinition::create('string_long')
->setLabel(t('GUID'))
->setDescription(t('Unique identifier for the feed item.'));
......
......@@ -10,7 +10,7 @@
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\block_content\BlockContentInterface;
/**
......@@ -138,29 +138,29 @@ public function delete() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['id'] = FieldDefinition::create('integer')
$fields['id'] = BaseFieldDefinition::create('integer')
->setLabel(t('Custom block ID'))
->setDescription(t('The custom block ID.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['uuid'] = FieldDefinition::create('uuid')
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The custom block UUID.'))
->setReadOnly(TRUE);
$fields['revision_id'] = FieldDefinition::create('integer')
$fields['revision_id'] = BaseFieldDefinition::create('integer')
->setLabel(t('Revision ID'))
->setDescription(t('The revision ID.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['langcode'] = FieldDefinition::create('language')
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language code'))
->setDescription(t('The custom block language code.'))
->setRevisionable(TRUE);
$fields['info'] = FieldDefinition::create('string')
$fields['info'] = BaseFieldDefinition::create('string')
->setLabel(t('Block description'))
->setDescription(t('A brief description of your block.'))
->setRevisionable(TRUE)
......@@ -172,17 +172,17 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
))
->setDisplayConfigurable('form', TRUE);
$fields['type'] = FieldDefinition::create('entity_reference')
$fields['type'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Block type'))
->setDescription(t('The block type.'))
->setSetting('target_type', 'block_content_type');
$fields['revision_log'] = FieldDefinition::create('string_long')
$fields['revision_log'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Revision log message'))
->setDescription(t('The log entry explaining the changes in this revision.'))
->setRevisionable(TRUE);
$fields['changed'] = FieldDefinition::create('changed')
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the custom block was last edited.'))
->setRevisionable(TRUE);
......
......@@ -12,7 +12,7 @@
use Drupal\comment\CommentInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\user\UserInterface;
......@@ -198,32 +198,32 @@ public function permalink() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['cid'] = FieldDefinition::create('integer')
$fields['cid'] = BaseFieldDefinition::create('integer')
->setLabel(t('Comment ID'))
->setDescription(t('The comment ID.'))
->setReadOnly(TRUE)
->setSetting('unsigned', TRUE);
$fields['uuid'] = FieldDefinition::create('uuid')
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The comment UUID.'))
->setReadOnly(TRUE);
$fields['pid'] = FieldDefinition::create('entity_reference')
$fields['pid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Parent ID'))
->setDescription(t('The parent comment ID if this is a reply to a comment.'))
->setSetting('target_type', 'comment');
$fields['entity_id'] = FieldDefinition::create('entity_reference')
$fields['entity_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Entity ID'))
->setDescription(t('The ID of the entity of which this comment is a reply.'))
->setRequired(TRUE);
$fields['langcode'] = FieldDefinition::create('language')
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language code'))
->setDescription(t('The comment language code.'));
$fields['subject'] = FieldDefinition::create('string')
$fields['subject'] = BaseFieldDefinition::create('string')
->setLabel(t('Subject'))
->setTranslatable(TRUE)
->setSetting('max_length', 64)
......@@ -234,14 +234,14 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
))
->setDisplayConfigurable('form', TRUE);
$fields['uid'] = FieldDefinition::create('entity_reference')
$fields['uid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('User ID'))
->setDescription(t('The user ID of the comment author.'))
->setTranslatable(TRUE)
->setSetting('target_type', 'user')
->setDefaultValue(0);
$fields['name'] = FieldDefinition::create('string')
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t("The comment author's name."))
->setTranslatable(TRUE)
......@@ -249,12 +249,12 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDefaultValue('')
->addConstraint('CommentName', array());
$fields['mail'] = FieldDefinition::create('email')
$fields['mail'] = BaseFieldDefinition::create('email')
->setLabel(t('Email'))
->setDescription(t("The comment author's email address."))
->setTranslatable(TRUE);
$fields['homepage'] = FieldDefinition::create('uri')
$fields['homepage'] = BaseFieldDefinition::create('uri')
->setLabel(t('Homepage'))
->setDescription(t("The comment author's home page address."))
->setTranslatable(TRUE)
......@@ -262,44 +262,44 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
// characters in our comment DB schema.
->setSetting('max_length', 255);
$fields['hostname'] = FieldDefinition::create('string')
$fields['hostname'] = BaseFieldDefinition::create('string')
->setLabel(t('Hostname'))
->setDescription(t("The comment author's hostname."))
->setTranslatable(TRUE)
->setSetting('max_length', 128);
$fields['created'] = FieldDefinition::create('created')
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('The time that the comment was created.'))
->setTranslatable(TRUE);
$fields['changed'] = FieldDefinition::create('changed')
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the comment was last edited.'))
->setTranslatable(TRUE);
$fields['status'] = FieldDefinition::create('boolean')
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the comment is published.'))
->setTranslatable(TRUE)
->setDefaultValue(TRUE);
$fields['thread'] = FieldDefinition::create('string')
$fields['thread'] = BaseFieldDefinition::create('string')
->setLabel(t('Thread place'))
->setDescription(t("The alphadecimal representation of the comment's place in a thread, consisting of a base 36 string prefixed by an integer indicating its length."))
->setSetting('max_length', 255);
$fields['entity_type'] = FieldDefinition::create('string')
$fields['entity_type'] = BaseFieldDefinition::create('string')
->setLabel(t('Entity type'))
->setDescription(t('The entity type to which this comment is attached.'))
->setSetting('max_length', EntityTypeInterface::ID_MAX_LENGTH);
$fields['comment_type'] = FieldDefinition::create('entity_reference')
$fields['comment_type'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Comment Type'))
->setDescription(t('The comment type.'))
->setSetting('target_type', 'comment_type');
$fields['field_name'] = FieldDefinition::create('string')
$fields['field_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Comment field name'))
->setDescription(t('The field name through which this comment was added.'))
->setSetting('max_length', FieldStorageConfig::NAME_MAX_LENGTH);
......
......@@ -10,7 +10,7 @@
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\contact\MessageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Defines the contact message entity.
......@@ -135,31 +135,31 @@ public function getPersonalRecipient() {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['category'] = FieldDefinition::create('entity_reference')
$fields['category'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Category ID'))
->setDescription(t('The ID of the associated category.'))
->setSetting('target_type', 'contact_category')
->setRequired(TRUE);
$fields['uuid'] = FieldDefinition::create('uuid')
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The message UUID.'))
->setReadOnly(TRUE);
$fields['langcode'] = FieldDefinition::create('language')
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language code'))
->setDescription(t('The comment language code.'));
$fields['name'] = FieldDefinition::create('string')
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t("The sender's name"))
->setDescription(t('The name of the person that is sending the contact message.'));
$fields['mail'] = FieldDefinition::create('email')
$fields['mail'] = BaseFieldDefinition::create('email')
->setLabel(t("The sender's email"))
->setDescription(t('The email of the person that is sending the contact message.'));
// The subject of the contact message.
$fields['subject'] = FieldDefinition::create('string')
$fields['subject'] = BaseFieldDefinition::create('string')
->setLabel(t('Subject'))
->setRequired(TRUE)
->setSetting('max_length', 100)
......@@ -170,7 +170,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDisplayConfigurable('form', TRUE);
// The text of the contact message.
$fields['message'] = FieldDefinition::create('string_long')
$fields['message'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Message'))
->setRequired(TRUE)
->setDisplayOptions('form', array(
......@@ -188,11 +188,11 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
))
->setDisplayConfigurable('view', TRUE);
$fields['copy'] = FieldDefinition::create('boolean')
$fields['copy'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Copy'))
->setDescription(t('Whether to send a copy of the message to the sender.'));
$fields['recipient'] = FieldDefinition::create('entity_reference')
$fields['recipient'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Recipient ID'))
->setDescription(t('The ID of the recipient user for personal contact messages.'))
->setSetting('target_type', 'user');
......
......@@ -5,7 +5,7 @@
* Contains custom contact message functionality for ContactStorageTest.
*/
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Implements hook_entity_base_field_info().
......@@ -13,7 +13,7 @@
function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
if ($entity_type->id() == 'contact_message') {
$fields = array();
$fields['id'] = FieldDefinition::create('integer')
$fields['id'] = BaseFieldDefinition::create('integer')
->setLabel(t('Message ID'))
->setDescription(t('The message ID.'))
->setReadOnly(TRUE)
......
......@@ -11,7 +11,7 @@
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\TypedData\FieldItemDataDefinition;
use Drupal\field\FieldException;
use Drupal\field\FieldStorageConfigInterface;
......@@ -638,7 +638,7 @@ public function __sleep() {
public static function createFromDataType($type) {
// Forward to the field definition class for creating new data definitions
// via the typed manager.
return FieldDefinition::createFromDataType($type);
return BaseFieldDefinition::createFromDataType($type);
}
/**
......@@ -647,7 +647,7 @@ public static function createFromDataType($type) {
public static function createFromItemType($item_type) {
// Forward to the field definition class for creating new data definitions
// via the typed manager.
return FieldDefinition::createFromItemType($item_type);
return BaseFieldDefinition::createFromItemType($item_type);
}
public function getDataType() {
......
......@@ -13,7 +13,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Field\FormatterPluginManager;
use Drupal\Core\Form\FormStateInterface;
......@@ -48,7 +48,7 @@ class Field extends FieldPluginBase {
*
* A field storage definition turned into a field definition, so it can be
* used with widgets and formatters. See
* FieldDefinition::createFromFieldStorageDefinition().
* BaseFieldDefinition::createFromFieldStorageDefinition().
*
* @var \Drupal\Core\Field\FieldDefinitionInterface
*/
......@@ -157,7 +157,7 @@ public static function create(ContainerInterface $container, array $configuratio
protected function getFieldDefinition() {
if (!$this->fieldDefinition) {
$field_storage_config = $this->getFieldStorageConfig();
$this->fieldDefinition = FieldDefinition::createFromFieldStorageDefinition($field_storage_config);
$this->fieldDefinition = BaseFieldDefinition::createFromFieldStorageDefinition($field_storage_config);
}
return $this->fieldDefinition;
}
......
......@@ -7,7 +7,7 @@
namespace Drupal\field\Tests;
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
......@@ -92,7 +92,7 @@ public function testTestItem() {
),
'foreign keys' => array(),
);
$field_schema = FieldDefinition::create('test_field')->getSchema();
$field_schema = BaseFieldDefinition::create('test_field')->getSchema();
$this->assertEqual($field_schema, $expected_schema);
}
......
......@@ -10,7 +10,7 @@
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;