diff --git a/core/includes/entity.inc b/core/includes/entity.inc index e3e7d90..6d53cab 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -535,13 +535,13 @@ function entity_form_submit_build_entity($entity_type, $entity, $form, &$form_st /** * Returns an entity list controller for a given entity type. * - * @see hook_entity_info() - * * @param string $entity_type * The type of the entity. * * @return Drupal\Core\Entity\EntityListControllerInterface * An entity list controller. + * + * @see hook_entity_info() */ function entity_list_controller($entity_type) { $controllers = &drupal_static(__FUNCTION__, array()); diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php index 6c4861b..8fa354b 100644 --- a/core/lib/Drupal/Core/Entity/EntityListController.php +++ b/core/lib/Drupal/Core/Entity/EntityListController.php @@ -27,12 +27,20 @@ class EntityListController implements EntityListControllerInterface { protected $entityType; /** - * The entity info. + * The entity info array. * * @var array + * + * @see entity_get_info() */ protected $entityInfo; + /** + * Constructs a new EntityListController object. + * + * @param string $entity_type. + * The type of entity to be listed. + */ public function __construct($entity_type) { $this->entityType = $entity_type; $this->storage = entity_get_controller($this->entityType); @@ -40,14 +48,14 @@ class EntityListController implements EntityListControllerInterface { } /** - * Implements Drupal\Core\Entity\EntityListControllerInterface::getStorageController(); + * Implements Drupal\Core\Entity\EntityListControllerInterface::getStorageController(). */ public function getStorageController() { return $this->storage; } /** - * Implements Drupal\Core\Entity\EntityListControllerInterface::load(); + * Implements Drupal\Core\Entity\EntityListControllerInterface::load(). */ public function load() { return $this->storage->load(); @@ -73,12 +81,21 @@ class EntityListController implements EntityListControllerInterface { return $operations; } + /** + * Retrieves the entity list path from the entity information. + * + * @return string + * The internal system path where the entity list will be rendered. + * + * @todo What is this method for, other than fetching the list path? Is this + * for http://drupal.org/node/1783964 ? Should it be on the interface? + */ public function getPath() { return $this->entityInfo['list path']; } /** - * Implements Drupal\Core\Entity\EntityListControllerInterface::buildHeader(); + * Implements Drupal\Core\Entity\EntityListControllerInterface::buildHeader(). */ public function buildHeader() { $row['label'] = t('Label'); @@ -88,7 +105,7 @@ class EntityListController implements EntityListControllerInterface { } /** - * Implements Drupal\Core\Entity\EntityListControllerInterface::buildRow(); + * Implements Drupal\Core\Entity\EntityListControllerInterface::buildRow(). */ public function buildRow(EntityInterface $entity) { $row['label'] = $entity->label(); @@ -99,7 +116,7 @@ class EntityListController implements EntityListControllerInterface { } /** - * Implements Drupal\Core\Entity\EntityListControllerInterface::buildOperations(); + * Implements Drupal\Core\Entity\EntityListControllerInterface::buildOperations(). */ public function buildOperations(EntityInterface $entity) { // Retrieve and sort operations. @@ -113,7 +130,7 @@ class EntityListController implements EntityListControllerInterface { } /** - * Implements Drupal\Core\Entity\EntityListControllerInterface::render(); + * Implements Drupal\Core\Entity\EntityListControllerInterface::render(). */ public function render() { $build = array( diff --git a/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php index e564243..3b49301 100644 --- a/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php @@ -15,12 +15,13 @@ interface EntityListControllerInterface { /** * Gets the entity storage controller. * - * @var Drupal\Core\Entity\EntityStorageControllerInterface + * @return Drupal\Core\Entity\EntityStorageControllerInterface + * The storage controller used by this list controller. */ public function getStorageController(); /** - * Loads entities of this type. + * Loads entities of this type from storage for listing. * * @return array * An array of entities implementing Drupal\Core\Entity\EntityInterface. @@ -28,13 +29,14 @@ interface EntityListControllerInterface { public function load(); /** - * Provides an array of information to render operation links. + * Provides an array of information to render the operation links. * * @param Drupal\Core\Entity\EntityInterface $entity * The entity the operations are for. * * @return array - * An array of operation link data to use in buildOperations. + * A array of operation link data to use in + * EntityListControllerInterface::buildOperations(). */ public function getOperations(EntityInterface $entity); @@ -50,6 +52,7 @@ interface EntityListControllerInterface { * Builds an array of data for each row. * * @param Drupal\Core\Entity\EntityInterface $entity + * The entity for this row of the list. * * @return array * An array of fields to use for this entity. @@ -59,6 +62,9 @@ interface EntityListControllerInterface { /** * Renders a list of operation links. * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity on which the linked operations will be performed. + * * @return array * A renderable array of operation links. */ diff --git a/core/modules/config/lib/Drupal/config/ConfigEntityListController.php b/core/modules/config/lib/Drupal/config/ConfigEntityListController.php index 7320291..9d6bdad 100644 --- a/core/modules/config/lib/Drupal/config/ConfigEntityListController.php +++ b/core/modules/config/lib/Drupal/config/ConfigEntityListController.php @@ -11,7 +11,7 @@ use Drupal\Core\Entity\EntityListController; use Drupal\Core\Entity\EntityInterface; /** - * Default list controller for ConfigEntity objects. + * Defines the default list controller for ConfigEntity objects. */ class ConfigEntityListController extends EntityListController { diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php index cf38bf7..f7bfd80 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php @@ -11,7 +11,7 @@ use Drupal\simpletest\WebTestBase; use Drupal\config_test\ConfigTest; /** - * Tests listing of configuration entities. + * Tests the listing of configuration entities. */ class ConfigEntityListTest extends WebTestBase { @@ -25,18 +25,20 @@ class ConfigEntityListTest extends WebTestBase { public static function getInfo() { return array( 'name' => 'Configuration entity list', - 'description' => 'Tests listing of configuration entities.', + 'description' => 'Tests the listing of configuration entities.', 'group' => 'Configuration', ); } /** - * Tests entity list controller functionality. + * Tests that the entity list controller loads a valid list of entities. */ function testList() { $controller = entity_list_controller('config_test'); - // Get a list of ConfigTest entities. + // Get a list of ConfigTest entities and confirm that it contains the + // ConfigTest entity provided by the config_test module. + // @see config_test.dynamic.default.yml $list = $controller->load(); $this->assertEqual(count($list), 1, '1 ConfigTest entity found.'); $this->assertTrue(!empty($list['default']), '"Default" ConfigTest entity ID found.'); @@ -54,7 +56,7 @@ class ConfigEntityListTest extends WebTestBase { $this->assertText('default'); $this->assertText('Default'); - // Verify that operation links appear. + // Verify that the expected operation links work. foreach (array('Edit', 'Delete') as $link) { $this->drupalSetContent($page); $this->assertLink($link);