Issue #2471689 by klopez, shashikant_chauhan, harings_rob, snehi, jhodgdon: Entity API documentation should consistently refer to handlers rather than controllers

8.2.x
Nathaniel Catchpole 2016-03-09 08:33:30 +09:00
parent 563ef19553
commit 49a419dea2
31 changed files with 47 additions and 44 deletions

View File

@ -145,16 +145,15 @@ function entity_revision_delete($entity_type, $revision_id) {
* database access if loaded again during the same page request.
*
* The actual loading is done through a class that has to implement the
* Drupal\Core\Entity\EntityStorageInterface interface. By default,
* Drupal\Core\Entity\Sql\SqlContentEntityStorage is used for content entities
* \Drupal\Core\Entity\EntityStorageInterface interface. By default,
* \Drupal\Core\Entity\Sql\SqlContentEntityStorage is used for content entities
* and Drupal\Core\Config\Entity\ConfigEntityStorage for config entities. Entity
* types can specify that a different class should be used by setting the
* "controllers['storage']" key in the entity plugin annotation. These classes
* can either implement the Drupal\Core\Entity\EntityStorageInterface
* "handlers['storage']" key in the entity plugin annotation. These classes
* can either implement the \Drupal\Core\Entity\EntityStorageInterface
* interface, or, most commonly, extend the
* Drupal\Core\Entity\Sql\SqlContentEntityStorage class.
* See Drupal\node\Entity\Node and Drupal\node\NodeStorage
* for an example.
* \Drupal\Core\Entity\Sql\SqlContentEntityStorage class. See
* \Drupal\node\Entity\Node and \Drupal\node\NodeStorage for an example.
*
* @param string $entity_type
* The entity type to load, e.g. node or user.

View File

@ -18,6 +18,8 @@ use Drupal\Core\StringTranslation\StringTranslationTrait;
* Implement the container injection pattern of
* \Drupal\Core\Entity\EntityHandlerInterface::createInstance() to obtain the
* module handler service for your class.
*
* @ingroup entity_api
*/
abstract class EntityHandlerBase {
use StringTranslationTrait;

View File

@ -14,6 +14,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* This interface can be implemented by entity handlers that require
* dependency injection.
*
* @ingroup entity_api
*/
interface EntityHandlerInterface {

View File

@ -277,8 +277,8 @@ use Drupal\node\Entity\NodeType;
* content entity type that uses bundles, the 'bundle_label' annotation gives
* the human-readable name to use for a bundle of this entity type (for
* example, "Content type" for the Node entity).
* - The annotation will refer to several controller classes, which you will
* also need to define:
* - The annotation will refer to several handler classes, which you will also
* need to define:
* - list_builder: Define a class that extends
* \Drupal\Core\Config\Entity\ConfigEntityListBuilder (for configuration
* entities) or \Drupal\Core\Entity\EntityListBuilder (for content
@ -298,7 +298,7 @@ use Drupal\node\Entity\NodeType;
* annotation has value TRUE), define a class that extends
* \Drupal\content_translation\ContentTranslationHandler, to translate
* the content. Configuration translation is handled automatically by the
* Configuration Translation module, without the need of a controller class.
* Configuration Translation module, without the need of a handler class.
* - access: If your configuration entity has complex permissions, you might
* need an access control handling, implementing
* \Drupal\Core\Entity\EntityAccessControlHandlerInterface, but most entities
@ -381,10 +381,10 @@ use Drupal\node\Entity\NodeType;
* an object to the controller for the route.
* - defaults: For entity form routes, use _entity_form rather than the generic
* _controller or _form. The value is composed of the entity type machine name
* and a form controller type from the entity annotation (see @ref define
* above more more on controllers and annotation). So, in this example,
* block.default refers to the 'default' form controller on the block entity
* type, whose annotation contains:
* and a form handler type from the entity annotation (see @ref define above
* more more on handlers and annotation). So, in this example, block.default
* refers to the 'default' form handler on the block entity type, whose
* annotation contains:
* @code
* handlers = {
* "form" = {

View File

@ -12,7 +12,7 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Form controller for the aggregator feed edit forms.
* Form handler for the aggregator feed edit forms.
*/
class FeedForm extends ContentEntityForm {

View File

@ -16,7 +16,7 @@ use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Render controller for aggregator feed items.
* View builder handler for aggregator feeds.
*/
class FeedViewBuilder extends EntityViewBuilder {

View File

@ -10,7 +10,7 @@ namespace Drupal\aggregator;
use Drupal\Core\Entity\EntityViewBuilder;
/**
* Render controller for aggregator feed items.
* View builder handler for aggregator feed items.
*/
class ItemViewBuilder extends EntityViewBuilder {

View File

@ -16,7 +16,7 @@ use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Form controller for the custom block edit forms.
* Form handler for the custom block edit forms.
*/
class BlockContentForm extends ContentEntityForm {

View File

@ -12,7 +12,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
/**
* Render controller for custom blocks.
* View builder handler for custom blocks.
*/
class BlockContentViewBuilder extends EntityViewBuilder {

View File

@ -20,7 +20,7 @@ use Drupal\Core\Session\AccountInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Base for controller for comment forms.
* Base handler for comment forms.
*/
class CommentForm extends ContentEntityForm {

View File

@ -19,7 +19,7 @@ use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines the controller class for comments.
* Defines the storage handler class for comments.
*
* This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class,
* adding required special handling for comment entities.

View File

@ -16,7 +16,7 @@ use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Base form controller for category edit forms.
* Base form handler for comment type edit forms.
*/
class CommentTypeForm extends EntityForm {

View File

@ -18,7 +18,7 @@ use Drupal\Core\Session\AccountInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Render controller for comments.
* View builder handler for comments.
*/
class CommentViewBuilder extends EntityViewBuilder {

View File

@ -130,14 +130,14 @@ class EntityDisplayModeListBuilder extends ConfigEntityListBuilder {
}
/**
* Filters entities based on their controllers.
* Filters entities based on their view builder handlers.
*
* @param $entity_type
* The entity type of the entity that needs to be validated.
*
* @return bool
* TRUE if the entity has the correct controller, FALSE if the entity
* doesn't has the correct controller.
* TRUE if the entity has the correct view builder handler, FALSE if the
* entity doesn't have the correct view builder handler.
*/
protected function isValidEntity($entity_type) {
return $this->entityTypes[$entity_type]->get('field_ui_base_route') && $this->entityTypes[$entity_type]->hasViewBuilderClass();

View File

@ -15,7 +15,7 @@ namespace Drupal\field_ui;
class EntityFormModeListBuilder extends EntityDisplayModeListBuilder {
/**
* Filters entities based on their controllers.
* Filters entities based on their form mode handlers.
*
* @param $entity_type
* The entity type of the entity that needs to be validated.

View File

@ -61,7 +61,7 @@ class LanguageListBuilder extends DraggableListBuilder {
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The entity storage controller class.
* The entity storage handler class.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory

View File

@ -14,7 +14,7 @@ use Drupal\user\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Form controller for the node edit forms.
* Form handler for the node edit forms.
*/
class NodeForm extends ContentEntityForm {

View File

@ -16,7 +16,7 @@ use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Defines a controller class that handles the node grants system.
* Defines a storage handler class that handles the node grants system.
*
* This is used to build node query access.
*

View File

@ -12,7 +12,7 @@ use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Language\LanguageInterface;
/**
* Defines the controller class for nodes.
* Defines the storage handler class for nodes.
*
* This extends the base storage class, adding required special handling for
* node entities.

View File

@ -15,7 +15,7 @@ use Drupal\language\Entity\ContentLanguageSettings;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Form controller for node type forms.
* Form handler for node type forms.
*/
class NodeTypeForm extends BundleEntityFormBase {

View File

@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\node\Entity\Node;
/**
* Render controller for nodes.
* View builder handler for nodes.
*/
class NodeViewBuilder extends EntityViewBuilder {

View File

@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class Type extends StringArgument {
/**
* NodeType storage controller.
* NodeType storage handler.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/

View File

@ -11,7 +11,7 @@ use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Form controller for the shortcut entity forms.
* Form handler for the shortcut entity forms.
*/
class ShortcutForm extends ContentEntityForm {

View File

@ -11,7 +11,7 @@ use Drupal\Core\Entity\BundleEntityFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Form controller for the shortcut set entity edit forms.
* Form handler for the shortcut set entity edit forms.
*/
class ShortcutSetForm extends BundleEntityFormBase {

View File

@ -27,7 +27,7 @@ class OverviewTerms extends FormBase {
protected $moduleHandler;
/**
* The term storage controller.
* The term storage handler.
*
* @var \Drupal\taxonomy\TermStorageInterface
*/

View File

@ -11,7 +11,7 @@ use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Base for controller for taxonomy term edit forms.
* Base for handler for taxonomy term edit forms.
*/
class TermForm extends ContentEntityForm {

View File

@ -12,7 +12,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
/**
* Render controller for taxonomy terms.
* View builder handler for taxonomy terms.
*/
class TermViewBuilder extends EntityViewBuilder {

View File

@ -10,7 +10,7 @@ namespace Drupal\taxonomy;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
/**
* Defines a controller class for taxonomy vocabularies.
* Defines a storage handler class for taxonomy vocabularies.
*/
class VocabularyStorage extends ConfigEntityStorage implements VocabularyStorageInterface {

View File

@ -13,7 +13,7 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManagerInterface;
/**
* Form controller for the profile forms.
* Form handler for the profile forms.
*/
class ProfileForm extends AccountForm {

View File

@ -13,7 +13,7 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManagerInterface;
/**
* Form controller for the user register forms.
* Form handler for the user register forms.
*/
class RegisterForm extends AccountForm {

View File

@ -28,7 +28,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
use StringTranslationTrait;
/**
* Entity type for this views controller instance.
* Entity type for this views data handler instance.
*
* @var \Drupal\Core\Entity\EntityTypeInterface
*/
@ -68,7 +68,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type to provide views integration for.
* @param \Drupal\Core\Entity\Sql\SqlEntityStorageInterface $storage_controller
* The storage controller used for this entity type.
* The storage handler used for this entity type.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler