diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 81195cf..b3171ea 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -307,13 +307,13 @@ function entity_page_label(EntityInterface $entity, $langcode = NULL) { /** * Returns the entity access controller for the given entity type. * - * @see hook_entity_info() - * * @param string $entity_type * The type of the entity. * - * @return Drupal\Core\Entity\EntityAccessControllerInterface + * @return \Drupal\Core\Entity\EntityAccessControllerInterface * An entity access controller instance. + * + * @see \Drupal\Core\Entity\EntityManager */ function entity_access_controller($entity_type) { $controllers = &drupal_static(__FUNCTION__, array()); diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessController.php index ae59203..e0203df 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Entity\EntityAccessController. + * Contains Drupal\Core\Entity\EntityAccessController. */ namespace Drupal\Core\Entity; @@ -10,7 +10,7 @@ use Drupal\user\Plugin\Core\Entity\User; /** - * Base class for entity access controllers. + * Defines a base class for entity access controllers. * * Defaults to FALSE (access denied) for 'view', 'create', 'update' and 'delete' * access checks. diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php index d9d2500..5bbc996 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Entity\EntityAccessControllerInterface. + * Contains Drupal\Core\Entity\EntityAccessControllerInterface. */ namespace Drupal\Core\Entity; @@ -19,12 +19,12 @@ * Checks 'view' access for a given entity or entity translation. * * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity to check 'view' access for. + * The entity for which to check 'view' access. * @param string $langcode - * (optional) The language code for which to check access for. Defaults to + * (optional) The language code for which to check access. Defaults to * LANGUAGE_DEFAULT. * @param \Drupal\user\Plugin\Core\Entity\User $account - * (optional) The user for whom to check access for, or NULL to check access + * (optional) The user for which to check access, or NULL to check access * for the current user. Defaults to NULL. * * @return bool @@ -36,12 +36,12 @@ public function viewAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT * Checks 'create' access for a given entity or entity translation. * * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity to check 'create' access for. + * The entity for which to check 'create' access. * @param string $langcode - * (optional) The language code for which to check access for. Defaults to + * (optional) The language code for which to check access. Defaults to * LANGUAGE_DEFAULT. * @param \Drupal\user\Plugin\Core\Entity\User $account - * (optional) The user for whom to check access for, or NULL to check access + * (optional) The user for which to check access, or NULL to check access * for the current user. Defaults to NULL. * * @return bool @@ -53,12 +53,12 @@ public function createAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAU * Checks 'update' access for a given entity or entity translation. * * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity to check 'update' access for. + * The entity to check 'update' access. * @param string $langcode - * (optional) The language code for which to check access for. Defaults to + * (optional) The language code for which to check access. Defaults to * LANGUAGE_DEFAULT. * @param \Drupal\user\Plugin\Core\Entity\User $account - * (optional) The user for whom to check access for, or NULL to check access + * (optional) The user for which to check access, or NULL to check access * for the current user. Defaults to NULL. * * @return bool @@ -70,12 +70,12 @@ public function updateAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAU * Checks 'delete' access for a given entity or entity translation. * * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity to check 'delete' access for. + * The entity for which to check 'delete' access. * @param string $langcode - * (optional) The language code for which to check access for. Defaults to + * (optional) The language code for which to check access. Defaults to * LANGUAGE_DEFAULT. * @param \Drupal\user\Plugin\Core\Entity\User $account - * (optional) The user for whom to check access for, or NULL to check access + * (optional) The user for which to check access, or NULL to check access * for the current user. Defaults to NULL. * * @return bool diff --git a/core/lib/Drupal/Core/TypedData/AccessibleInterface.php b/core/lib/Drupal/Core/TypedData/AccessibleInterface.php index bec1f61..d120584 100644 --- a/core/lib/Drupal/Core/TypedData/AccessibleInterface.php +++ b/core/lib/Drupal/Core/TypedData/AccessibleInterface.php @@ -23,7 +23,7 @@ * - delete * Defaults to 'view'. * @param \Drupal\user\Plugin\Core\Entity\User $account - * (optional) The user for whom to check access for, or NULL to check access + * (optional) The user for which to check access, or NULL to check access * for the current user. Defaults to NULL. * * @return bool diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php index 9958b62..4a3fdfb 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\system\Tests\Entity\EntityAccessTest. + * Contains Drupal\system\Tests\Entity\EntityAccessTest. */ namespace Drupal\system\Tests\Entity; @@ -82,12 +82,12 @@ function testEntityAccess() { */ function testEntityAccessDefaultController() { // Remove the access controller definition from the test entity. - variable_set('entity_test_default_access_controller', TRUE); + state()->set('entity_test.default_access_controller', TRUE); // Check that the default access controller is used for entities that don't // have a specific access controller defined. $controller = entity_access_controller('entity_test'); - $this->assertTrue(is_a($controller, '\Drupal\Core\Entity\EntityAccessController'), 'The default entity controller is used for the entity_test entity type.'); + $this->assertTrue($controller instanceof '\Drupal\Core\Entity\EntityAccessController', 'The default entity controller is used for the entity_test entity type.'); $entity = entity_create('entity_test', array()); $this->assertEntityAccess(array( @@ -103,7 +103,7 @@ function testEntityAccessDefaultController() { */ function testEntityTranslationAccess() { // Enable translations for the test entity type. - variable_set('entity_test_translation', TRUE); + state()->set('entity_test_translation', TRUE); module_enable(array('locale')); // Set up a non-admin user that is allowed to view test entity translations. diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index f716913..403c1b9 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -17,7 +17,7 @@ function entity_test_entity_info_alter(&$info) { $info['entity_test']['translation']['entity_test'] = TRUE; } // Optionally unset the access controller to test the fallback. - if (variable_get('entity_test_default_access_controller')) { + if (state()->get('entity_test.default_access_controller')) { unset($info['entity_test']['access_controller_class']); } } diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php index 186bafa..591f3d1 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\entity_test\EntityTestAccessController. + * Contains Drupal\entity_test\EntityTestAccessController. */ namespace Drupal\entity_test; @@ -12,7 +12,7 @@ use Drupal\user\Plugin\Core\Entity\User; /** - * Access controller for the test entity. + * Defines the access controller for the test entity type. */ class EntityTestAccessController implements EntityAccessControllerInterface {