Issue #2024963 by Berdir: Move baseFieldDefinitions from storage to entity classes.
parent
52771351f9
commit
48ddeb48db
|
@ -437,14 +437,6 @@ class ConfigStorageController extends EntityStorageControllerBase {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
// @todo: Define abstract once all entity types have been converted.
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes a hook on behalf of the entity.
|
||||
*
|
||||
|
|
|
@ -552,14 +552,6 @@ class DatabaseStorageController extends EntityStorageControllerBase {
|
|||
module_invoke_all('entity_' . $hook, $entity, $this->entityType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
// @todo: Define abstract once all entity types have been converted.
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::getQueryServiceName().
|
||||
*/
|
||||
|
|
|
@ -634,4 +634,11 @@ class Entity implements IteratorAggregate, EntityInterface {
|
|||
// http://drupal.org/node/2004244
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -619,4 +619,11 @@ class EntityBCDecorator implements IteratorAggregate, EntityInterface {
|
|||
$this->decorated->initTranslation($langcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -326,4 +326,20 @@ interface EntityInterface extends IdentifiableInterface, ComplexDataInterface, A
|
|||
*/
|
||||
public function initTranslation($langcode);
|
||||
|
||||
/**
|
||||
* Defines the base fields of the entity type.
|
||||
*
|
||||
* @param string $entity_type
|
||||
* The entity type to return properties for. Useful when a single class is
|
||||
* used for multiple, possibly dynamic entity types.
|
||||
*
|
||||
* @return array
|
||||
* An array of entity field definitions as specified by
|
||||
* \Drupal\Core\Entity\EntityManager::getFieldDefinitions(), keyed by field
|
||||
* name.
|
||||
*
|
||||
* @see \Drupal\Core\Entity\EntityManager::getFieldDefinitions()
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type);
|
||||
|
||||
}
|
||||
|
|
|
@ -395,8 +395,9 @@ class EntityManager extends PluginManagerBase {
|
|||
$this->entityFieldInfo[$entity_type] = $cache->data;
|
||||
}
|
||||
else {
|
||||
$class = $this->factory->getPluginClass($entity_type, $this->getDefinition($entity_type));
|
||||
$this->entityFieldInfo[$entity_type] = array(
|
||||
'definitions' => $this->getStorageController($entity_type)->baseFieldDefinitions(),
|
||||
'definitions' => $class::baseFieldDefinitions($entity_type),
|
||||
// Contains definitions of optional (per-bundle) fields.
|
||||
'optional' => array(),
|
||||
// An array keyed by bundle name containing the optional fields added
|
||||
|
|
|
@ -136,18 +136,6 @@ interface EntityStorageControllerInterface {
|
|||
*/
|
||||
public function save(EntityInterface $entity);
|
||||
|
||||
/**
|
||||
* Defines the base fields of the entity type.
|
||||
*
|
||||
* @return array
|
||||
* An array of entity field definitions as specified by
|
||||
* \Drupal\Core\Entity\EntityManager::getFieldDefinitions(), keyed by field
|
||||
* name.
|
||||
*
|
||||
* @see \Drupal\Core\Entity\EntityManager::getFieldDefinitions()
|
||||
*/
|
||||
public function baseFieldDefinitions();
|
||||
|
||||
/**
|
||||
* Gets the name of the service for the query for this entity storage.
|
||||
*
|
||||
|
|
|
@ -264,4 +264,82 @@ class Feed extends EntityNG implements FeedInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$fields['fid'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The ID of the aggregor feed.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['title'] = array(
|
||||
'label' => t('Title'),
|
||||
'description' => t('The title of the feed.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The feed language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$fields['url'] = array(
|
||||
'label' => t('URL'),
|
||||
'description' => t('The URL to the feed.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['refresh'] = array(
|
||||
'label' => t('Refresh'),
|
||||
'description' => t('How often to check for new feed items, in seconds.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['checked'] = array(
|
||||
'label' => t('Checked'),
|
||||
'description' => t('Last time feed was checked for new items, as Unix timestamp.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['queued'] = array(
|
||||
'label' => t('Queued'),
|
||||
'description' => t('Time when this feed was queued for refresh, 0 if not queued.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['link'] = array(
|
||||
'label' => t('Link'),
|
||||
'description' => t('The link of the feed.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['description'] = array(
|
||||
'label' => t('Description'),
|
||||
'description' => t("The parent website's description that comes from the !description element in the feed.", array('!description' => '<description>')),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['image'] = array(
|
||||
'label' => t('image'),
|
||||
'description' => t('An image representing the feed.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['hash'] = array(
|
||||
'label' => t('Hash'),
|
||||
'description' => t('Calculated hash of the feed data, used for validating cache.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['etag'] = array(
|
||||
'label' => t('Etag'),
|
||||
'description' => t('Entity tag HTTP response header, used for validating cache.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['modified'] = array(
|
||||
'label' => t('Modified'),
|
||||
'description' => t('When the feed was last modified, as a Unix timestamp.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['block'] = array(
|
||||
'label' => t('Block'),
|
||||
'description' => t('Number of items to display in the feed’s block.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,4 +154,57 @@ class Item extends EntityNG implements ItemInterface {
|
|||
public static function preDelete(EntityStorageControllerInterface $storage_controller, array $entities) {
|
||||
$storage_controller->deleteCategories($entities);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$fields['iid'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The ID of the aggregor item.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['fid'] = array(
|
||||
'label' => t('Aggregator feed ID'),
|
||||
'description' => t('The ID of the aggregator feed.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['title'] = array(
|
||||
'label' => t('Title'),
|
||||
'description' => t('The title of the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The feed item language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$fields['link'] = array(
|
||||
'label' => t('Link'),
|
||||
'description' => t('The link of the feed item.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['author'] = array(
|
||||
'label' => t('Author'),
|
||||
'description' => t('The author of the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['description'] = array(
|
||||
'label' => t('Description'),
|
||||
'description' => t('The body of the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['timestamp'] = array(
|
||||
'label' => t('Posted timestamp'),
|
||||
'description' => t('Posted date of the feed item, as a Unix timestamp.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['guid'] = array(
|
||||
'label' => t('GUID'),
|
||||
'description' => t('Unique identifier for the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,84 +27,6 @@ class FeedStorageController extends DatabaseStorageControllerNG implements FeedS
|
|||
$this->loadCategories($queried_entities);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Entity\DataBaseStorageControllerNG::baseFieldDefinitions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$fields['fid'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The ID of the aggregor feed.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['title'] = array(
|
||||
'label' => t('Title'),
|
||||
'description' => t('The title of the feed.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The feed language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$fields['url'] = array(
|
||||
'label' => t('URL'),
|
||||
'description' => t('The URL to the feed.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['refresh'] = array(
|
||||
'label' => t('Refresh'),
|
||||
'description' => t('How often to check for new feed items, in seconds.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['checked'] = array(
|
||||
'label' => t('Checked'),
|
||||
'description' => t('Last time feed was checked for new items, as Unix timestamp.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['queued'] = array(
|
||||
'label' => t('Queued'),
|
||||
'description' => t('Time when this feed was queued for refresh, 0 if not queued.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['link'] = array(
|
||||
'label' => t('Link'),
|
||||
'description' => t('The link of the feed.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['description'] = array(
|
||||
'label' => t('Description'),
|
||||
'description' => t("The parent website's description that comes from the !description element in the feed.", array('!description' => '<description>')),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['image'] = array(
|
||||
'label' => t('image'),
|
||||
'description' => t('An image representing the feed.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['hash'] = array(
|
||||
'label' => t('Hash'),
|
||||
'description' => t('Calculated hash of the feed data, used for validating cache.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['etag'] = array(
|
||||
'label' => t('Etag'),
|
||||
'description' => t('Entity tag HTTP response header, used for validating cache.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['modified'] = array(
|
||||
'label' => t('Modified'),
|
||||
'description' => t('When the feed was last modified, as a Unix timestamp.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['block'] = array(
|
||||
'label' => t('Block'),
|
||||
'description' => t('Number of items to display in the feed’s block.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -28,59 +28,6 @@ class ItemStorageController extends DatabaseStorageControllerNG implements ItemS
|
|||
$this->loadCategories($queried_entities);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Entity\DataBaseStorageControllerNG::baseFieldDefinitions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$fields['iid'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The ID of the aggregor item.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['fid'] = array(
|
||||
'label' => t('Aggregator feed ID'),
|
||||
'description' => t('The ID of the aggregator feed.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['title'] = array(
|
||||
'label' => t('Title'),
|
||||
'description' => t('The title of the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The feed item language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$fields['link'] = array(
|
||||
'label' => t('Link'),
|
||||
'description' => t('The link of the feed item.'),
|
||||
'type' => 'uri_field',
|
||||
);
|
||||
$fields['author'] = array(
|
||||
'label' => t('Author'),
|
||||
'description' => t('The author of the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['description'] = array(
|
||||
'label' => t('Description'),
|
||||
'description' => t('The body of the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['timestamp'] = array(
|
||||
'label' => t('Posted timestamp'),
|
||||
'description' => t('Posted date of the feed item, as a Unix timestamp.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$fields['guid'] = array(
|
||||
'label' => t('GUID'),
|
||||
'description' => t('Unique identifier for the feed item.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -36,47 +36,4 @@ class CustomBlockStorageController extends DatabaseStorageControllerNG implement
|
|||
parent::attachLoad($blocks, $load_revision);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Entity\DataBaseStorageControllerNG::basePropertyDefinitions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$properties['id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The custom block ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The custom block UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
);
|
||||
$properties['revision_id'] = array(
|
||||
'label' => t('Revision ID'),
|
||||
'description' => t('The revision ID.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The comment language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['info'] = array(
|
||||
'label' => t('Subject'),
|
||||
'description' => t('The custom block name.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['type'] = array(
|
||||
'label' => t('Block type'),
|
||||
'description' => t('The block type.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['log'] = array(
|
||||
'label' => t('Revision log message'),
|
||||
'description' => t('The revision log message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -235,4 +235,47 @@ class CustomBlock extends EntityNG implements CustomBlockInterface {
|
|||
parent::delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$properties['id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The custom block ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The custom block UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
);
|
||||
$properties['revision_id'] = array(
|
||||
'label' => t('Revision ID'),
|
||||
'description' => t('The revision ID.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The comment language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['info'] = array(
|
||||
'label' => t('Subject'),
|
||||
'description' => t('The custom block name.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['type'] = array(
|
||||
'label' => t('Block type'),
|
||||
'description' => t('The block type.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['log'] = array(
|
||||
'label' => t('Revision log message'),
|
||||
'description' => t('The revision log message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,111 +100,6 @@ class CommentStorageController extends DatabaseStorageControllerNG implements Co
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$properties['cid'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The comment ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The comment UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
);
|
||||
$properties['pid'] = array(
|
||||
'label' => t('Parent ID'),
|
||||
'description' => t('The parent comment ID if this is a reply to a comment.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'comment'),
|
||||
);
|
||||
$properties['nid'] = array(
|
||||
'label' => t('Node ID'),
|
||||
'description' => t('The ID of the node of which this comment is a reply.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'node'),
|
||||
'required' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The comment language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['subject'] = array(
|
||||
'label' => t('Subject'),
|
||||
'description' => t('The comment title or subject.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID of the comment author.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array(
|
||||
'target_type' => 'user',
|
||||
'default_value' => 0,
|
||||
),
|
||||
);
|
||||
$properties['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t("The comment author's name."),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['mail'] = array(
|
||||
'label' => t('e-mail'),
|
||||
'description' => t("The comment author's e-mail address."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['homepage'] = array(
|
||||
'label' => t('Homepage'),
|
||||
'description' => t("The comment author's home page address."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['hostname'] = array(
|
||||
'label' => t('Hostname'),
|
||||
'description' => t("The comment author's hostname."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['created'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the comment was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['changed'] = array(
|
||||
'label' => t('Changed'),
|
||||
'description' => t('The time that the comment was last edited.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('Publishing status'),
|
||||
'description' => t('A boolean indicating whether the comment is published.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['thread'] = array(
|
||||
'label' => t('Thread place'),
|
||||
'description' => 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."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['node_type'] = array(
|
||||
// @todo: The bundle property should be stored so it's queryable.
|
||||
'label' => t('Node type'),
|
||||
'description' => t("The comment node type."),
|
||||
'type' => 'string_field',
|
||||
'queryable' => FALSE,
|
||||
);
|
||||
$properties['new'] = array(
|
||||
'label' => t('Comment new marker'),
|
||||
'description' => t("The comment 'new' marker for the current user (0 read, 1 new, 2 updated)."),
|
||||
'type' => 'integer_field',
|
||||
'computed' => TRUE,
|
||||
'class' => '\Drupal\comment\CommentNewItem',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -354,4 +354,109 @@ class Comment extends EntityNG implements CommentInterface {
|
|||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$properties['cid'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The comment ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The comment UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
);
|
||||
$properties['pid'] = array(
|
||||
'label' => t('Parent ID'),
|
||||
'description' => t('The parent comment ID if this is a reply to a comment.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'comment'),
|
||||
);
|
||||
$properties['nid'] = array(
|
||||
'label' => t('Node ID'),
|
||||
'description' => t('The ID of the node of which this comment is a reply.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'node'),
|
||||
'required' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The comment language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['subject'] = array(
|
||||
'label' => t('Subject'),
|
||||
'description' => t('The comment title or subject.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID of the comment author.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array(
|
||||
'target_type' => 'user',
|
||||
'default_value' => 0,
|
||||
),
|
||||
);
|
||||
$properties['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t("The comment author's name."),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['mail'] = array(
|
||||
'label' => t('e-mail'),
|
||||
'description' => t("The comment author's e-mail address."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['homepage'] = array(
|
||||
'label' => t('Homepage'),
|
||||
'description' => t("The comment author's home page address."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['hostname'] = array(
|
||||
'label' => t('Hostname'),
|
||||
'description' => t("The comment author's hostname."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['created'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the comment was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['changed'] = array(
|
||||
'label' => t('Changed'),
|
||||
'description' => t('The time that the comment was last edited.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('Publishing status'),
|
||||
'description' => t('A boolean indicating whether the comment is published.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['thread'] = array(
|
||||
'label' => t('Thread place'),
|
||||
'description' => 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."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['node_type'] = array(
|
||||
// @todo: The bundle property should be stored so it's queryable.
|
||||
'label' => t('Node type'),
|
||||
'description' => t("The comment node type."),
|
||||
'type' => 'string_field',
|
||||
'queryable' => FALSE,
|
||||
);
|
||||
$properties['new'] = array(
|
||||
'label' => t('Comment new marker'),
|
||||
'description' => t("The comment 'new' marker for the current user (0 read, 1 new, 2 updated)."),
|
||||
'type' => 'integer_field',
|
||||
'computed' => TRUE,
|
||||
'class' => '\Drupal\comment\CommentNewItem',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ use Drupal\contact\MessageInterface;
|
|||
* label = @Translation("Contact message"),
|
||||
* module = "contact",
|
||||
* controllers = {
|
||||
* "storage" = "Drupal\contact\MessageStorageController",
|
||||
* "storage" = "Drupal\Core\Entity\DatabaseStorageControllerNG",
|
||||
* "render" = "Drupal\contact\MessageRenderController",
|
||||
* "form" = {
|
||||
* "default" = "Drupal\contact\MessageFormController"
|
||||
|
@ -138,4 +138,49 @@ class Message extends EntityNG implements MessageInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$fields['category'] = array(
|
||||
'label' => t('Category ID'),
|
||||
'description' => t('The ID of the associated category.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'contact_category'),
|
||||
'required' => TRUE,
|
||||
);
|
||||
$fields['name'] = array(
|
||||
'label' => t("The sender's name"),
|
||||
'description' => t('The name of the person that is sending the contact message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['mail'] = array(
|
||||
'label' => t("The sender's e-mail"),
|
||||
'description' => t('The e-mail of the person that is sending the contact message.'),
|
||||
'type' => 'email_field',
|
||||
);
|
||||
$fields['subject'] = array(
|
||||
'label' => t('The message subject'),
|
||||
'description' => t('The subject of the contact message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['message'] = array(
|
||||
'label' => t('The message text'),
|
||||
'description' => t('The text of the contact message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['copy'] = array(
|
||||
'label' => t('Copy'),
|
||||
'description' => t('Whether to send a copy of the message to the sender.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$fields['recipient'] = array(
|
||||
'label' => t('Recipient ID'),
|
||||
'description' => t('The ID of the recipient user for personal contact messages.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\contact\MessageStorageController.
|
||||
*/
|
||||
|
||||
namespace Drupal\contact;
|
||||
|
||||
use Drupal\Core\Entity\DatabaseStorageControllerNG;
|
||||
|
||||
/**
|
||||
* Defines the controller class for the contact message entity.
|
||||
*/
|
||||
class MessageStorageController extends DatabaseStorageControllerNG {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$fields['category'] = array(
|
||||
'label' => t('Category ID'),
|
||||
'description' => t('The ID of the associated category.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'contact_category'),
|
||||
'required' => TRUE,
|
||||
);
|
||||
$fields['name'] = array(
|
||||
'label' => t("The sender's name"),
|
||||
'description' => t('The name of the person that is sending the contact message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['mail'] = array(
|
||||
'label' => t("The sender's e-mail"),
|
||||
'description' => t('The e-mail of the person that is sending the contact message.'),
|
||||
'type' => 'email_field',
|
||||
);
|
||||
$fields['subject'] = array(
|
||||
'label' => t('The message subject'),
|
||||
'description' => t('The subject of the contact message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['message'] = array(
|
||||
'label' => t('The message text'),
|
||||
'description' => t('The text of the contact message.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$fields['copy'] = array(
|
||||
'label' => t('Copy'),
|
||||
'description' => t('Whether to send a copy of the message to the sender.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$fields['recipient'] = array(
|
||||
'label' => t('Recipient ID'),
|
||||
'description' => t('The ID of the recipient user for personal contact messages.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
|
@ -208,4 +208,64 @@ class File extends EntityNG implements FileInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$properties['fid'] = array(
|
||||
'label' => t('File ID'),
|
||||
'description' => t('The file ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The file UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The file language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID of the file.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
);
|
||||
$properties['filename'] = array(
|
||||
'label' => t('Filename'),
|
||||
'description' => t('Name of the file with no path components.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['uri'] = array(
|
||||
'label' => t('URI'),
|
||||
'description' => t('The URI to access the file (either local or remote).'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['filemime'] = array(
|
||||
'label' => t('File MIME type'),
|
||||
'description' => t("The file's MIME type."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['filesize'] = array(
|
||||
'label' => t('File size'),
|
||||
'description' => t('The size of the file in bytes.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('Status'),
|
||||
'description' => t('The status of the file, temporary (0) and permanent (1)'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['timestamp'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the node was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,64 +38,4 @@ class FileStorageController extends DatabaseStorageControllerNG implements FileS
|
|||
':timestamp' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$properties['fid'] = array(
|
||||
'label' => t('File ID'),
|
||||
'description' => t('The file ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The file UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The file language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID of the file.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
);
|
||||
$properties['filename'] = array(
|
||||
'label' => t('Filename'),
|
||||
'description' => t('Name of the file with no path components.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['uri'] = array(
|
||||
'label' => t('URI'),
|
||||
'description' => t('The URI to access the file (either local or remote).'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['filemime'] = array(
|
||||
'label' => t('File MIME type'),
|
||||
'description' => t("The file's MIME type."),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['filesize'] = array(
|
||||
'label' => t('File size'),
|
||||
'description' => t('The size of the file in bytes.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('Status'),
|
||||
'description' => t('The status of the file, temporary (0) and permanent (1)'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['timestamp'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the node was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,4 +271,122 @@ class Node extends EntityNG implements NodeInterface {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$properties['nid'] = array(
|
||||
'label' => t('Node ID'),
|
||||
'description' => t('The node ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The node UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['vid'] = array(
|
||||
'label' => t('Revision ID'),
|
||||
'description' => t('The node revision ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['type'] = array(
|
||||
'label' => t('Type'),
|
||||
'description' => t('The node type.'),
|
||||
'type' => 'string_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The node language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['title'] = array(
|
||||
'label' => t('Title'),
|
||||
'description' => t('The title of this node, always treated as non-markup plain text.'),
|
||||
'type' => 'string_field',
|
||||
'required' => TRUE,
|
||||
'settings' => array(
|
||||
'default_value' => '',
|
||||
),
|
||||
'property_constraints' => array(
|
||||
'value' => array('Length' => array('max' => 255)),
|
||||
),
|
||||
);
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID of the node author.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array(
|
||||
'target_type' => 'user',
|
||||
'default_value' => 0,
|
||||
),
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('Publishing status'),
|
||||
'description' => t('A boolean indicating whether the node is published.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['created'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the node was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['changed'] = array(
|
||||
'label' => t('Changed'),
|
||||
'description' => t('The time that the node was last edited.'),
|
||||
'type' => 'integer_field',
|
||||
'property_constraints' => array(
|
||||
'value' => array('NodeChanged' => array()),
|
||||
),
|
||||
);
|
||||
$properties['comment'] = array(
|
||||
'label' => t('Comment'),
|
||||
'description' => t('Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write).'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['promote'] = array(
|
||||
'label' => t('Promote'),
|
||||
'description' => t('A boolean indicating whether the node should be displayed on the front page.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['sticky'] = array(
|
||||
'label' => t('Sticky'),
|
||||
'description' => t('A boolean indicating whether the node should be displayed at the top of lists in which it appears.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['tnid'] = array(
|
||||
'label' => t('Translation set ID'),
|
||||
'description' => t('The translation set id for this node, which equals the node id of the source post in each set.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['translate'] = array(
|
||||
'label' => t('Translate'),
|
||||
'description' => t('A boolean indicating whether this translation page needs to be updated.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['revision_timestamp'] = array(
|
||||
'label' => t('Revision timestamp'),
|
||||
'description' => t('The time that the current revision was created.'),
|
||||
'type' => 'integer_field',
|
||||
'queryable' => FALSE,
|
||||
);
|
||||
$properties['revision_uid'] = array(
|
||||
'label' => t('Revision user ID'),
|
||||
'description' => t('The user ID of the author of the current revision.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
'queryable' => FALSE,
|
||||
);
|
||||
$properties['log'] = array(
|
||||
'label' => t('Log'),
|
||||
'description' => t('The log entry explaining the changes in this version.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,122 +92,4 @@ class NodeStorageController extends DatabaseStorageControllerNG {
|
|||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\Core\Entity\DataBaseStorageControllerNG::basePropertyDefinitions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$properties['nid'] = array(
|
||||
'label' => t('Node ID'),
|
||||
'description' => t('The node ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The node UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['vid'] = array(
|
||||
'label' => t('Revision ID'),
|
||||
'description' => t('The node revision ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['type'] = array(
|
||||
'label' => t('Type'),
|
||||
'description' => t('The node type.'),
|
||||
'type' => 'string_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The node language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['title'] = array(
|
||||
'label' => t('Title'),
|
||||
'description' => t('The title of this node, always treated as non-markup plain text.'),
|
||||
'type' => 'string_field',
|
||||
'required' => TRUE,
|
||||
'settings' => array(
|
||||
'default_value' => '',
|
||||
),
|
||||
'property_constraints' => array(
|
||||
'value' => array('Length' => array('max' => 255)),
|
||||
),
|
||||
);
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID of the node author.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array(
|
||||
'target_type' => 'user',
|
||||
'default_value' => 0,
|
||||
),
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('Publishing status'),
|
||||
'description' => t('A boolean indicating whether the node is published.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['created'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the node was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['changed'] = array(
|
||||
'label' => t('Changed'),
|
||||
'description' => t('The time that the node was last edited.'),
|
||||
'type' => 'integer_field',
|
||||
'property_constraints' => array(
|
||||
'value' => array('NodeChanged' => array()),
|
||||
),
|
||||
);
|
||||
$properties['comment'] = array(
|
||||
'label' => t('Comment'),
|
||||
'description' => t('Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write).'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['promote'] = array(
|
||||
'label' => t('Promote'),
|
||||
'description' => t('A boolean indicating whether the node should be displayed on the front page.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['sticky'] = array(
|
||||
'label' => t('Sticky'),
|
||||
'description' => t('A boolean indicating whether the node should be displayed at the top of lists in which it appears.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['tnid'] = array(
|
||||
'label' => t('Translation set ID'),
|
||||
'description' => t('The translation set id for this node, which equals the node id of the source post in each set.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['translate'] = array(
|
||||
'label' => t('Translate'),
|
||||
'description' => t('A boolean indicating whether this translation page needs to be updated.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
$properties['revision_timestamp'] = array(
|
||||
'label' => t('Revision timestamp'),
|
||||
'description' => t('The time that the current revision was created.'),
|
||||
'type' => 'integer_field',
|
||||
'queryable' => FALSE,
|
||||
);
|
||||
$properties['revision_uid'] = array(
|
||||
'label' => t('Revision user ID'),
|
||||
'description' => t('The user ID of the author of the current revision.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
'queryable' => FALSE,
|
||||
);
|
||||
$properties['log'] = array(
|
||||
'label' => t('Log'),
|
||||
'description' => t('The log entry explaining the changes in this version.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,4 +101,50 @@ class EntityTest extends EntityNG {
|
|||
return parent::label($langcode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$fields['id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The ID of the test entity.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The UUID of the test entity.'),
|
||||
'type' => 'uuid_field',
|
||||
);
|
||||
$fields['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The language code of the test entity.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$fields['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The name of the test entity.'),
|
||||
'type' => 'string_field',
|
||||
'translatable' => TRUE,
|
||||
'property_constraints' => array(
|
||||
'value' => array('Length' => array('max' => 32)),
|
||||
),
|
||||
);
|
||||
$fields['type'] = array(
|
||||
'label' => t('Type'),
|
||||
'description' => t('The bundle of the test entity.'),
|
||||
'type' => 'string_field',
|
||||
'required' => TRUE,
|
||||
// @todo: Add allowed values validation.
|
||||
);
|
||||
$fields['user_id'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The ID of the associated user.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
'translatable' => TRUE,
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\entity_test\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityNG;
|
||||
use Drupal\Core\Entity\Annotation\EntityType;
|
||||
use Drupal\Core\Annotation\Translation;
|
||||
use Drupal\Core\Language\Language;
|
||||
|
@ -38,7 +37,7 @@ use Drupal\Core\Language\Language;
|
|||
* menu_base_path = "entity-test/manage/%entity_test"
|
||||
* )
|
||||
*/
|
||||
class EntityTestCache extends EntityNG {
|
||||
class EntityTestCache extends EntityTest {
|
||||
|
||||
/**
|
||||
* The entity ID.
|
||||
|
|
|
@ -19,7 +19,7 @@ use Drupal\Core\Annotation\Translation;
|
|||
* label = @Translation("Test entity - data table"),
|
||||
* module = "entity_test",
|
||||
* controllers = {
|
||||
* "storage" = "Drupal\entity_test\EntityTestMulStorageController",
|
||||
* "storage" = "Drupal\entity_test\EntityTestStorageController",
|
||||
* "access" = "Drupal\entity_test\EntityTestAccessController",
|
||||
* "form" = {
|
||||
* "default" = "Drupal\entity_test\EntityTestFormController"
|
||||
|
@ -40,4 +40,17 @@ use Drupal\Core\Annotation\Translation;
|
|||
*/
|
||||
class EntityTestMul extends EntityTest {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
$fields['default_langcode'] = array(
|
||||
'label' => t('Default language'),
|
||||
'description' => t('Flag to indicate whether this is the default language.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use Drupal\Core\Annotation\Translation;
|
|||
* label = @Translation("Test entity - revisions and data table"),
|
||||
* module = "entity_test",
|
||||
* controllers = {
|
||||
* "storage" = "Drupal\entity_test\EntityTestMulRevStorageController",
|
||||
* "storage" = "Drupal\entity_test\EntityTestStorageController",
|
||||
* "access" = "Drupal\entity_test\EntityTestAccessController",
|
||||
* "form" = {
|
||||
* "default" = "Drupal\entity_test\EntityTestFormController"
|
||||
|
@ -42,4 +42,23 @@ use Drupal\Core\Annotation\Translation;
|
|||
*/
|
||||
class EntityTestMulRev extends EntityTestRev {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
$fields['revision_id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The version id of the test entity.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['default_langcode'] = array(
|
||||
'label' => t('Default language'),
|
||||
'description' => t('Flag to inditcate whether this is the default language.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use Drupal\Core\Annotation\Translation;
|
|||
* label = @Translation("Test entity - revisions"),
|
||||
* module = "entity_test",
|
||||
* controllers = {
|
||||
* "storage" = "Drupal\entity_test\EntityTestRevStorageController",
|
||||
* "storage" = "Drupal\entity_test\EntityTestStorageController",
|
||||
* "access" = "Drupal\entity_test\EntityTestAccessController",
|
||||
* "form" = {
|
||||
* "default" = "Drupal\entity_test\EntityTestFormController"
|
||||
|
@ -61,4 +61,18 @@ class EntityTestRev extends EntityTest {
|
|||
public function getRevisionId() {
|
||||
return $this->get('revision_id')->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
$fields['revision_id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The version id of the test entity.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\entity_test\EntityTestMulRevStorageController.
|
||||
*/
|
||||
|
||||
namespace Drupal\entity_test;
|
||||
|
||||
use Drupal\entity_test\EntityTestStorageController;
|
||||
|
||||
/**
|
||||
* Defines the controller class for the test entity.
|
||||
*
|
||||
* This extends the Drupal\entity_test\EntityTestStorageController class, adding
|
||||
* required special handling for test entities with multilingual property and
|
||||
* revision support.
|
||||
*/
|
||||
class EntityTestMulRevStorageController extends EntityTestStorageController {
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\entity_test\EntityTestStorageController::baseFieldDefinitions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$fields = parent::baseFieldDefinitions();
|
||||
$fields['revision_id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The version id of the test entity.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['default_langcode'] = array(
|
||||
'label' => t('Default language'),
|
||||
'description' => t('Flag to inditcate whether this is the default language.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\entity_test\EntityTestMulStorageController.
|
||||
*/
|
||||
|
||||
namespace Drupal\entity_test;
|
||||
|
||||
use Drupal\entity_test\EntityTestStorageController;
|
||||
|
||||
/**
|
||||
* Defines the controller class for the test entity.
|
||||
*
|
||||
* This extends the Drupal\entity_test\EntityTestStorageController class, adding
|
||||
* required special handling for test entities with multilingual property
|
||||
* support.
|
||||
*/
|
||||
class EntityTestMulStorageController extends EntityTestStorageController {
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\entity_test\EntityTestStorageController::baseFieldDefinitions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$fields = parent::baseFieldDefinitions();
|
||||
$fields['default_langcode'] = array(
|
||||
'label' => t('Default language'),
|
||||
'description' => t('Flag to indicate whether this is the default language.'),
|
||||
'type' => 'boolean_field',
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\entity_test\EntityTestRevStorageController.
|
||||
*/
|
||||
|
||||
namespace Drupal\entity_test;
|
||||
|
||||
use Drupal\entity_test\EntityTestStorageController;
|
||||
|
||||
/**
|
||||
* Defines the controller class for the test entity.
|
||||
*
|
||||
* This extends the Drupal\entity_test\EntityTestStorageController class, adding
|
||||
* required special handling for test entities with revision support.
|
||||
*/
|
||||
class EntityTestRevStorageController extends EntityTestStorageController {
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\entity_test\EntityTestStorageController::baseFieldDefinitions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$fields = parent::baseFieldDefinitions();
|
||||
$fields['revision_id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The version id of the test entity.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
|
@ -27,49 +27,4 @@ class EntityTestStorageController extends DatabaseStorageControllerNG {
|
|||
return parent::create($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$fields['id'] = array(
|
||||
'label' => t('ID'),
|
||||
'description' => t('The ID of the test entity.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$fields['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The UUID of the test entity.'),
|
||||
'type' => 'uuid_field',
|
||||
);
|
||||
$fields['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The language code of the test entity.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$fields['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The name of the test entity.'),
|
||||
'type' => 'string_field',
|
||||
'translatable' => TRUE,
|
||||
'property_constraints' => array(
|
||||
'value' => array('Length' => array('max' => 32)),
|
||||
),
|
||||
);
|
||||
$fields['type'] = array(
|
||||
'label' => t('Type'),
|
||||
'description' => t('The bundle of the test entity.'),
|
||||
'type' => 'string_field',
|
||||
'required' => TRUE,
|
||||
// @todo: Add allowed values validation.
|
||||
);
|
||||
$fields['user_id'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The ID of the associated user.'),
|
||||
'type' => 'entity_reference_field',
|
||||
'settings' => array('target_type' => 'user'),
|
||||
'translatable' => TRUE,
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,4 +185,63 @@ class Term extends EntityNG implements TermInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$properties['tid'] = array(
|
||||
'label' => t('Term ID'),
|
||||
'description' => t('The term ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The term UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['vid'] = array(
|
||||
'label' => t('Vocabulary ID'),
|
||||
'description' => t('The ID of the vocabulary to which the term is assigned.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The term language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The term name.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['description'] = array(
|
||||
'label' => t('Description'),
|
||||
'description' => t('A description of the term'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
// @todo Combine with description.
|
||||
$properties['format'] = array(
|
||||
'label' => t('Description format'),
|
||||
'description' => t('The filter format ID of the description.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['weight'] = array(
|
||||
'label' => t('Weight'),
|
||||
'description' => t('The weight of this term in relation to other terms.'),
|
||||
'type' => 'integer_field',
|
||||
'settings' => array('default_value' => 0),
|
||||
);
|
||||
$properties['parent'] = array(
|
||||
'label' => t('Term Parents'),
|
||||
'description' => t('The parents of this term.'),
|
||||
'type' => 'integer_field',
|
||||
// Save new terms with no parents by default.
|
||||
'settings' => array('default_value' => 0),
|
||||
'computed' => TRUE,
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,65 +57,6 @@ class TermStorageController extends DatabaseStorageControllerNG implements TermS
|
|||
parent::resetCache($ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\Core\Entity\DatabaseStorageControllerNG::baseFieldDefintions().
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$properties['tid'] = array(
|
||||
'label' => t('Term ID'),
|
||||
'description' => t('The term ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The term UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['vid'] = array(
|
||||
'label' => t('Vocabulary ID'),
|
||||
'description' => t('The ID of the vocabulary to which the term is assigned.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The term language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The term name.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['description'] = array(
|
||||
'label' => t('Description'),
|
||||
'description' => t('A description of the term'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
// @todo Combine with description.
|
||||
$properties['format'] = array(
|
||||
'label' => t('Description format'),
|
||||
'description' => t('The filter format ID of the description.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['weight'] = array(
|
||||
'label' => t('Weight'),
|
||||
'description' => t('The weight of this term in relation to other terms.'),
|
||||
'type' => 'integer_field',
|
||||
'settings' => array('default_value' => 0),
|
||||
);
|
||||
$properties['parent'] = array(
|
||||
'label' => t('Term Parents'),
|
||||
'description' => t('The parents of this term.'),
|
||||
'type' => 'integer_field',
|
||||
// Save new terms with no parents by default.
|
||||
'settings' => array('default_value' => 0),
|
||||
'computed' => TRUE,
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -410,4 +410,109 @@ class User extends EntityNG implements UserInterface {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The user UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The user language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['preferred_langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t("The user's preferred langcode for receiving emails and viewing the site."),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['preferred_admin_langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t("The user's preferred langcode for viewing administration pages."),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The name of this user'),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['pass'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The password of this user (hashed)'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['mail'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The e-mail of this user'),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['signature'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The signature of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['signature_format'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The signature format of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['theme'] = array(
|
||||
'label' => t('Theme'),
|
||||
'description' => t('The default theme of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['timezone'] = array(
|
||||
'label' => t('Timezone'),
|
||||
'description' => t('The timezone of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('User status'),
|
||||
'description' => t('Whether the user is active (1) or blocked (0).'),
|
||||
'type' => 'boolean_field',
|
||||
'settings' => array('default_value' => 1),
|
||||
);
|
||||
$properties['created'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the node was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['access'] = array(
|
||||
'label' => t('Last access'),
|
||||
'description' => t('The time that the user last accessed the site.'),
|
||||
'type' => 'integer_field',
|
||||
'settings' => array('default_value' => 0),
|
||||
);
|
||||
$properties['login'] = array(
|
||||
'label' => t('Last login'),
|
||||
'description' => t('The time that the user last logged in.'),
|
||||
'type' => 'integer_field',
|
||||
'settings' => array('default_value' => 0),
|
||||
);
|
||||
$properties['init'] = array(
|
||||
'label' => t('Init'),
|
||||
'description' => t('The email address used for initial account creation.'),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['roles'] = array(
|
||||
'label' => t('Roles'),
|
||||
'description' => t('The roles the user has.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -158,109 +158,4 @@ class UserStorageController extends DatabaseStorageControllerNG implements UserS
|
|||
// Invoke the respective entity-level hook.
|
||||
\Drupal::moduleHandler()->invokeAll('entity_' . $hook, array($entity, $this->entityType));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function baseFieldDefinitions() {
|
||||
$properties['uid'] = array(
|
||||
'label' => t('User ID'),
|
||||
'description' => t('The user ID.'),
|
||||
'type' => 'integer_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['uuid'] = array(
|
||||
'label' => t('UUID'),
|
||||
'description' => t('The user UUID.'),
|
||||
'type' => 'uuid_field',
|
||||
'read-only' => TRUE,
|
||||
);
|
||||
$properties['langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t('The user language code.'),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['preferred_langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t("The user's preferred langcode for receiving emails and viewing the site."),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['preferred_admin_langcode'] = array(
|
||||
'label' => t('Language code'),
|
||||
'description' => t("The user's preferred langcode for viewing administration pages."),
|
||||
'type' => 'language_field',
|
||||
);
|
||||
$properties['name'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The name of this user'),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['pass'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The password of this user (hashed)'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['mail'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The e-mail of this user'),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['signature'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The signature of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['signature_format'] = array(
|
||||
'label' => t('Name'),
|
||||
'description' => t('The signature format of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['theme'] = array(
|
||||
'label' => t('Theme'),
|
||||
'description' => t('The default theme of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['timezone'] = array(
|
||||
'label' => t('Timezone'),
|
||||
'description' => t('The timezone of this user'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
$properties['status'] = array(
|
||||
'label' => t('User status'),
|
||||
'description' => t('Whether the user is active (1) or blocked (0).'),
|
||||
'type' => 'boolean_field',
|
||||
'settings' => array('default_value' => 1),
|
||||
);
|
||||
$properties['created'] = array(
|
||||
'label' => t('Created'),
|
||||
'description' => t('The time that the node was created.'),
|
||||
'type' => 'integer_field',
|
||||
);
|
||||
$properties['access'] = array(
|
||||
'label' => t('Last access'),
|
||||
'description' => t('The time that the user last accessed the site.'),
|
||||
'type' => 'integer_field',
|
||||
'settings' => array('default_value' => 0),
|
||||
);
|
||||
$properties['login'] = array(
|
||||
'label' => t('Last login'),
|
||||
'description' => t('The time that the user last logged in.'),
|
||||
'type' => 'integer_field',
|
||||
'settings' => array('default_value' => 0),
|
||||
);
|
||||
$properties['init'] = array(
|
||||
'label' => t('Init'),
|
||||
'description' => t('The email address used for initial account creation.'),
|
||||
'type' => 'string_field',
|
||||
'settings' => array('default_value' => ''),
|
||||
);
|
||||
$properties['roles'] = array(
|
||||
'label' => t('Roles'),
|
||||
'description' => t('The roles the user has.'),
|
||||
'type' => 'string_field',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1236,4 +1236,14 @@ class ViewUI implements ViewStorageInterface {
|
|||
public function uriRelationships() {
|
||||
return $this->storage->uriRelationships();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions($entity_type) {
|
||||
// @todo: This class is not directly defined as an entity type and does
|
||||
// not have base definitions but has to implement this method. Remove in
|
||||
// http://drupal.org/node/2024963.
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue