Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443205
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443205
Commits
e3ea8e6b
Commit
e3ea8e6b
authored
9 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2341399
by fago, DuaelFr, rpayanm: Follow-up: entity.api.php documentation fixes
parent
3f00a89f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/Entity/Entity.php
+1
-1
1 addition, 1 deletion
core/lib/Drupal/Core/Entity/Entity.php
core/lib/Drupal/Core/Entity/entity.api.php
+30
-30
30 additions, 30 deletions
core/lib/Drupal/Core/Entity/entity.api.php
with
31 additions
and
31 deletions
core/lib/Drupal/Core/Entity/Entity.php
+
1
−
1
View file @
e3ea8e6b
...
@@ -311,7 +311,7 @@ public function access($operation, AccountInterface $account = NULL, $return_as_
...
@@ -311,7 +311,7 @@ public function access($operation, AccountInterface $account = NULL, $return_as_
->
getAccessControlHandler
(
$this
->
entityTypeId
)
->
getAccessControlHandler
(
$this
->
entityTypeId
)
->
createAccess
(
$this
->
bundle
(),
$account
,
[],
$return_as_object
);
->
createAccess
(
$this
->
bundle
(),
$account
,
[],
$return_as_object
);
}
}
return
$this
->
entityManager
()
return
$this
->
entityManager
()
->
getAccessControlHandler
(
$this
->
entityTypeId
)
->
getAccessControlHandler
(
$this
->
entityTypeId
)
->
access
(
$this
,
$operation
,
LanguageInterface
::
LANGCODE_DEFAULT
,
$account
,
$return_as_object
);
->
access
(
$this
,
$operation
,
LanguageInterface
::
LANGCODE_DEFAULT
,
$account
,
$return_as_object
);
}
}
...
...
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/Entity/entity.api.php
+
30
−
30
View file @
e3ea8e6b
...
@@ -517,19 +517,19 @@
...
@@ -517,19 +517,19 @@
* @param string $operation
* @param string $operation
* The operation that is to be performed on $entity.
* The operation that is to be performed on $entity.
* @param \Drupal\Core\Session\AccountInterface $account
* @param \Drupal\Core\Session\AccountInterface $account
*
The account trying to access the entity.
* The account trying to access the entity.
* @param string $langcode
* @param string $langcode
*
The code of the language $entity is accessed in.
* The code of the language $entity is accessed in.
*
*
* @return \Drupal\Core\Access\AccessResultInterface
* @return \Drupal\Core\Access\AccessResultInterface
*
The access result. The final result is calculated by using
* The access result. The final result is calculated by using
*
\Drupal\Core\Access\AccessResultInterface::orIf() on the result of every
* \Drupal\Core\Access\AccessResultInterface::orIf() on the result of every
*
hook_entity_access() and hook_ENTITY_TYPE_access() implementation, and the
* hook_entity_access() and hook_ENTITY_TYPE_access() implementation, and the
*
result of the entity-specific checkAccess() method in the entity access
* result of the entity-specific checkAccess() method in the entity access
*
control handler. Be careful when writing generalized access checks shared
* control handler. Be careful when writing generalized access checks shared
*
between routing and entity checks: routing uses the andIf() operator. So
* between routing and entity checks: routing uses the andIf() operator. So
*
returning an isNeutral() does not determine entity access at all but it
* returning an isNeutral() does not determine entity access at all but it
*
always ends up denying access while routing.
* always ends up denying access while routing.
*
*
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see hook_entity_create_access()
* @see hook_entity_create_access()
...
@@ -550,12 +550,12 @@ function hook_entity_access(\Drupal\Core\Entity\EntityInterface $entity, $operat
...
@@ -550,12 +550,12 @@ function hook_entity_access(\Drupal\Core\Entity\EntityInterface $entity, $operat
* @param string $operation
* @param string $operation
* The operation that is to be performed on $entity.
* The operation that is to be performed on $entity.
* @param \Drupal\Core\Session\AccountInterface $account
* @param \Drupal\Core\Session\AccountInterface $account
*
The account trying to access the entity.
* The account trying to access the entity.
* @param string $langcode
* @param string $langcode
*
The code of the language $entity is accessed in.
* The code of the language $entity is accessed in.
*
*
* @return \Drupal\Core\Access\AccessResultInterface
* @return \Drupal\Core\Access\AccessResultInterface
*
The access result. hook_entity_access() has detailed documentation.
* The access result. hook_entity_access() has detailed documentation.
*
*
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see hook_ENTITY_TYPE_create_access()
* @see hook_ENTITY_TYPE_create_access()
...
@@ -572,16 +572,16 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o
...
@@ -572,16 +572,16 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o
* Control entity create access.
* Control entity create access.
*
*
* @param \Drupal\Core\Session\AccountInterface $account
* @param \Drupal\Core\Session\AccountInterface $account
*
The account trying to access the entity.
* The account trying to access the entity.
* @param array $context
* @param array $context
*
An associative array of additional context values. By default it contains
* An associative array of additional context values. By default it contains
*
language:
* language:
*
- langcode - the current language code.
* - langcode - the current language code.
* @param string $entity_bundle
* @param string $entity_bundle
*
The entity bundle name.
* The entity bundle name.
*
*
* @return \Drupal\Core\Access\AccessResultInterface
* @return \Drupal\Core\Access\AccessResultInterface
*
The access result.
* The access result.
*
*
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see hook_entity_access()
* @see hook_entity_access()
...
@@ -598,16 +598,16 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun
...
@@ -598,16 +598,16 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun
* Control entity create access for a specific entity type.
* Control entity create access for a specific entity type.
*
*
* @param \Drupal\Core\Session\AccountInterface $account
* @param \Drupal\Core\Session\AccountInterface $account
*
The account trying to access the entity.
* The account trying to access the entity.
* @param array $context
* @param array $context
*
An associative array of additional context values. By default it contains
* An associative array of additional context values. By default it contains
*
language:
* language:
*
- langcode - the current language code.
* - langcode - the current language code.
* @param string $entity_bundle
* @param string $entity_bundle
*
The entity bundle name.
* The entity bundle name.
*
*
* @return \Drupal\Core\Access\AccessResultInterface
* @return \Drupal\Core\Access\AccessResultInterface
*
The access result.
* The access result.
*
*
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see \Drupal\Core\Entity\EntityAccessControlHandler
* @see hook_ENTITY_TYPE_access()
* @see hook_ENTITY_TYPE_access()
...
@@ -1064,7 +1064,7 @@ function hook_ENTITY_TYPE_translation_insert(\Drupal\Core\Entity\EntityInterface
...
@@ -1064,7 +1064,7 @@ function hook_ENTITY_TYPE_translation_insert(\Drupal\Core\Entity\EntityInterface
*
*
* This hook runs once the entity translation has been deleted from storage.
* This hook runs once the entity translation has been deleted from storage.
*
*
* @param \Drupal\Core\Entity\EntityInterface $
entity
* @param \Drupal\Core\Entity\EntityInterface $
translation
* The original entity object.
* The original entity object.
*
*
* @ingroup entity_crud
* @ingroup entity_crud
...
@@ -1084,7 +1084,7 @@ function hook_entity_translation_delete(\Drupal\Core\Entity\EntityInterface $tra
...
@@ -1084,7 +1084,7 @@ function hook_entity_translation_delete(\Drupal\Core\Entity\EntityInterface $tra
*
*
* This hook runs once the entity translation has been deleted from storage.
* This hook runs once the entity translation has been deleted from storage.
*
*
* @param \Drupal\Core\Entity\EntityInterface $
entity
* @param \Drupal\Core\Entity\EntityInterface $
translation
* The original entity object.
* The original entity object.
*
*
* @ingroup entity_crud
* @ingroup entity_crud
...
@@ -1679,7 +1679,7 @@ function hook_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $en
...
@@ -1679,7 +1679,7 @@ function hook_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $en
* @see hook_entity_bundle_field_info_alter()
* @see hook_entity_bundle_field_info_alter()
*
*
* @todo WARNING: This hook will be changed in
* @todo WARNING: This hook will be changed in
*
https://www.drupal.org/node/2346329.
* https://www.drupal.org/node/2346329.
*/
*/
function
hook_entity_base_field_info_alter
(
&
$fields
,
\Drupal\Core\Entity\EntityTypeInterface
$entity_type
)
{
function
hook_entity_base_field_info_alter
(
&
$fields
,
\Drupal\Core\Entity\EntityTypeInterface
$entity_type
)
{
// Alter the mymodule_text field to use a custom class.
// Alter the mymodule_text field to use a custom class.
...
@@ -1714,7 +1714,7 @@ function hook_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityT
...
@@ -1714,7 +1714,7 @@ function hook_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityT
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
*
*
* @todo WARNING: This hook will be changed in
* @todo WARNING: This hook will be changed in
*
https://www.drupal.org/node/2346347.
* https://www.drupal.org/node/2346347.
*/
*/
function
hook_entity_bundle_field_info
(
\Drupal\Core\Entity\EntityTypeInterface
$entity_type
,
$bundle
,
array
$base_field_definitions
)
{
function
hook_entity_bundle_field_info
(
\Drupal\Core\Entity\EntityTypeInterface
$entity_type
,
$bundle
,
array
$base_field_definitions
)
{
// Add a property only to nodes of the 'article' bundle.
// Add a property only to nodes of the 'article' bundle.
...
@@ -1743,7 +1743,7 @@ function hook_entity_bundle_field_info(\Drupal\Core\Entity\EntityTypeInterface $
...
@@ -1743,7 +1743,7 @@ function hook_entity_bundle_field_info(\Drupal\Core\Entity\EntityTypeInterface $
* @see hook_entity_bundle_field_info()
* @see hook_entity_bundle_field_info()
*
*
* @todo WARNING: This hook will be changed in
* @todo WARNING: This hook will be changed in
*
https://www.drupal.org/node/2346347.
* https://www.drupal.org/node/2346347.
*/
*/
function
hook_entity_bundle_field_info_alter
(
&
$fields
,
\Drupal\Core\Entity\EntityTypeInterface
$entity_type
,
$bundle
)
{
function
hook_entity_bundle_field_info_alter
(
&
$fields
,
\Drupal\Core\Entity\EntityTypeInterface
$entity_type
,
$bundle
)
{
if
(
$entity_type
->
id
()
==
'node'
&&
$bundle
==
'article'
&&
!
empty
(
$fields
[
'mymodule_text'
]))
{
if
(
$entity_type
->
id
()
==
'node'
&&
$bundle
==
'article'
&&
!
empty
(
$fields
[
'mymodule_text'
]))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment