Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
303
Merge Requests
303
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
48ddeb48
Commit
48ddeb48
authored
Aug 27, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2024963
by Berdir: Move baseFieldDefinitions from storage to entity classes.
parent
52771351
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
805 additions
and
867 deletions
+805
-867
core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
...lib/Drupal/Core/Config/Entity/ConfigStorageController.php
+0
-8
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
+0
-8
core/lib/Drupal/Core/Entity/Entity.php
core/lib/Drupal/Core/Entity/Entity.php
+7
-0
core/lib/Drupal/Core/Entity/EntityBCDecorator.php
core/lib/Drupal/Core/Entity/EntityBCDecorator.php
+7
-0
core/lib/Drupal/Core/Entity/EntityInterface.php
core/lib/Drupal/Core/Entity/EntityInterface.php
+16
-0
core/lib/Drupal/Core/Entity/EntityManager.php
core/lib/Drupal/Core/Entity/EntityManager.php
+2
-1
core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php
...b/Drupal/Core/Entity/EntityStorageControllerInterface.php
+0
-12
core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php
.../modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php
+78
-0
core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php
.../modules/aggregator/lib/Drupal/aggregator/Entity/Item.php
+53
-0
core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php
...ggregator/lib/Drupal/aggregator/FeedStorageController.php
+0
-78
core/modules/aggregator/lib/Drupal/aggregator/ItemStorageController.php
...ggregator/lib/Drupal/aggregator/ItemStorageController.php
+0
-53
core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockStorageController.php
.../lib/Drupal/custom_block/CustomBlockStorageController.php
+0
-43
core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php
...stom_block/lib/Drupal/custom_block/Entity/CustomBlock.php
+43
-0
core/modules/comment/lib/Drupal/comment/CommentStorageController.php
...s/comment/lib/Drupal/comment/CommentStorageController.php
+0
-105
core/modules/comment/lib/Drupal/comment/Entity/Comment.php
core/modules/comment/lib/Drupal/comment/Entity/Comment.php
+105
-0
core/modules/contact/lib/Drupal/contact/Entity/Message.php
core/modules/contact/lib/Drupal/contact/Entity/Message.php
+46
-1
core/modules/contact/lib/Drupal/contact/MessageStorageController.php
...s/contact/lib/Drupal/contact/MessageStorageController.php
+0
-61
core/modules/file/lib/Drupal/file/Entity/File.php
core/modules/file/lib/Drupal/file/Entity/File.php
+60
-0
core/modules/file/lib/Drupal/file/FileStorageController.php
core/modules/file/lib/Drupal/file/FileStorageController.php
+0
-60
core/modules/node/lib/Drupal/node/Entity/Node.php
core/modules/node/lib/Drupal/node/Entity/Node.php
+118
-0
core/modules/node/lib/Drupal/node/NodeStorageController.php
core/modules/node/lib/Drupal/node/NodeStorageController.php
+0
-118
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php
.../entity_test/lib/Drupal/entity_test/Entity/EntityTest.php
+46
-0
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestCache.php
...ty_test/lib/Drupal/entity_test/Entity/EntityTestCache.php
+1
-2
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
...tity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php
+14
-1
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
...y_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php
+20
-1
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php
...tity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php
+15
-1
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestMulRevStorageController.php
.../Drupal/entity_test/EntityTestMulRevStorageController.php
+0
-39
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestMulStorageController.php
...lib/Drupal/entity_test/EntityTestMulStorageController.php
+0
-33
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestRevStorageController.php
...lib/Drupal/entity_test/EntityTestRevStorageController.php
+0
-33
core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php
...st/lib/Drupal/entity_test/EntityTestStorageController.php
+0
-45
core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
+59
-0
core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
...es/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
+0
-59
core/modules/user/lib/Drupal/user/Entity/User.php
core/modules/user/lib/Drupal/user/Entity/User.php
+105
-0
core/modules/user/lib/Drupal/user/UserStorageController.php
core/modules/user/lib/Drupal/user/UserStorageController.php
+0
-105
core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+10
-0
No files found.
core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
View file @
48ddeb48
...
...
@@ -437,14 +437,6 @@ public function save(EntityInterface $entity) {
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.
*
...
...
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
View file @
48ddeb48
...
...
@@ -552,14 +552,6 @@ protected function invokeHook($hook, EntityInterface $entity) {
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().
*/
...
...
core/lib/Drupal/Core/Entity/Entity.php
View file @
48ddeb48
...
...
@@ -634,4 +634,11 @@ public function initTranslation($langcode) {
// http://drupal.org/node/2004244
}
/**
* {@inheritdoc}
*/
public
static
function
baseFieldDefinitions
(
$entity_type
)
{
return
array
();
}
}
core/lib/Drupal/Core/Entity/EntityBCDecorator.php
View file @
48ddeb48
...
...
@@ -619,4 +619,11 @@ public function initTranslation($langcode) {
$this
->
decorated
->
initTranslation
(
$langcode
);
}
/**
* {@inheritdoc}
*/
public
static
function
baseFieldDefinitions
(
$entity_type
)
{
return
array
();
}
}
core/lib/Drupal/Core/Entity/EntityInterface.php
View file @
48ddeb48
...
...
@@ -326,4 +326,20 @@ public function isTranslatable();
*/
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
);
}
core/lib/Drupal/Core/Entity/EntityManager.php
View file @
48ddeb48
...
...
@@ -395,8 +395,9 @@ public function getFieldDefinitions($entity_type, $bundle = NULL) {
$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
...
...
core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php
View file @
48ddeb48
...
...
@@ -136,18 +136,6 @@ public function delete(array $entities);
*/
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.
*
...
...
core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php
View file @
48ddeb48
...
...
@@ -264,4 +264,82 @@ protected function clearBlockCacheDefinitions() {
}
}
/**
* {@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
;
}
}
core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php
View file @
48ddeb48
...
...
@@ -154,4 +154,57 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
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
;
}
}
core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php
View file @
48ddeb48
...
...
@@ -27,84 +27,6 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
$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}
*/
...
...
core/modules/aggregator/lib/Drupal/aggregator/ItemStorageController.php
View file @
48ddeb48
...
...
@@ -28,59 +28,6 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
$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}
*/
...
...
core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockStorageController.php
View file @
48ddeb48
...
...
@@ -36,47 +36,4 @@ protected function attachLoad(&$blocks, $load_revision = FALSE) {
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
;
}
}
core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php
View file @
48ddeb48
...
...
@@ -235,4 +235,47 @@ public function delete() {
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
;
}
}
core/modules/comment/lib/Drupal/comment/CommentStorageController.php
View file @
48ddeb48
...
...
@@ -100,111 +100,6 @@ public function updateNodeStatistics($nid) {
}
}
/**
* {@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'
,
);