Commit 49a419de authored by catch's avatar catch
Browse files

Issue #2471689 by klopez, shashikant_chauhan, harings_rob, snehi, jhodgdon:...

Issue #2471689 by klopez, shashikant_chauhan, harings_rob, snehi, jhodgdon: Entity API documentation should consistently refer to handlers rather than controllers
parent 563ef195
...@@ -145,16 +145,15 @@ function entity_revision_delete($entity_type, $revision_id) { ...@@ -145,16 +145,15 @@ function entity_revision_delete($entity_type, $revision_id) {
* database access if loaded again during the same page request. * database access if loaded again during the same page request.
* *
* The actual loading is done through a class that has to implement the * The actual loading is done through a class that has to implement the
* Drupal\Core\Entity\EntityStorageInterface interface. By default, * \Drupal\Core\Entity\EntityStorageInterface interface. By default,
* Drupal\Core\Entity\Sql\SqlContentEntityStorage is used for content entities * \Drupal\Core\Entity\Sql\SqlContentEntityStorage is used for content entities
* and Drupal\Core\Config\Entity\ConfigEntityStorage for config entities. Entity * and Drupal\Core\Config\Entity\ConfigEntityStorage for config entities. Entity
* types can specify that a different class should be used by setting the * types can specify that a different class should be used by setting the
* "controllers['storage']" key in the entity plugin annotation. These classes * "handlers['storage']" key in the entity plugin annotation. These classes
* can either implement the Drupal\Core\Entity\EntityStorageInterface * can either implement the \Drupal\Core\Entity\EntityStorageInterface
* interface, or, most commonly, extend the * interface, or, most commonly, extend the
* Drupal\Core\Entity\Sql\SqlContentEntityStorage class. * \Drupal\Core\Entity\Sql\SqlContentEntityStorage class. See
* See Drupal\node\Entity\Node and Drupal\node\NodeStorage * \Drupal\node\Entity\Node and \Drupal\node\NodeStorage for an example.
* for an example.
* *
* @param string $entity_type * @param string $entity_type
* The entity type to load, e.g. node or user. * The entity type to load, e.g. node or user.
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* Implement the container injection pattern of * Implement the container injection pattern of
* \Drupal\Core\Entity\EntityHandlerInterface::createInstance() to obtain the * \Drupal\Core\Entity\EntityHandlerInterface::createInstance() to obtain the
* module handler service for your class. * module handler service for your class.
*
* @ingroup entity_api
*/ */
abstract class EntityHandlerBase { abstract class EntityHandlerBase {
use StringTranslationTrait; use StringTranslationTrait;
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* *
* This interface can be implemented by entity handlers that require * This interface can be implemented by entity handlers that require
* dependency injection. * dependency injection.
*
* @ingroup entity_api
*/ */
interface EntityHandlerInterface { interface EntityHandlerInterface {
......
...@@ -277,8 +277,8 @@ ...@@ -277,8 +277,8 @@
* content entity type that uses bundles, the 'bundle_label' annotation gives * 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 * the human-readable name to use for a bundle of this entity type (for
* example, "Content type" for the Node entity). * example, "Content type" for the Node entity).
* - The annotation will refer to several controller classes, which you will * - The annotation will refer to several handler classes, which you will also
* also need to define: * need to define:
* - list_builder: Define a class that extends * - list_builder: Define a class that extends
* \Drupal\Core\Config\Entity\ConfigEntityListBuilder (for configuration * \Drupal\Core\Config\Entity\ConfigEntityListBuilder (for configuration
* entities) or \Drupal\Core\Entity\EntityListBuilder (for content * entities) or \Drupal\Core\Entity\EntityListBuilder (for content
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
* annotation has value TRUE), define a class that extends * annotation has value TRUE), define a class that extends
* \Drupal\content_translation\ContentTranslationHandler, to translate * \Drupal\content_translation\ContentTranslationHandler, to translate
* the content. Configuration translation is handled automatically by the * 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 * - access: If your configuration entity has complex permissions, you might
* need an access control handling, implementing * need an access control handling, implementing
* \Drupal\Core\Entity\EntityAccessControlHandlerInterface, but most entities * \Drupal\Core\Entity\EntityAccessControlHandlerInterface, but most entities
...@@ -381,10 +381,10 @@ ...@@ -381,10 +381,10 @@
* an object to the controller for the route. * an object to the controller for the route.
* - defaults: For entity form routes, use _entity_form rather than the generic * - 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 * _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 * and a form handler type from the entity annotation (see @ref define above
* above more more on controllers and annotation). So, in this example, * more more on handlers and annotation). So, in this example, block.default
* block.default refers to the 'default' form controller on the block entity * refers to the 'default' form handler on the block entity type, whose
* type, whose annotation contains: * annotation contains:
* @code * @code
* handlers = { * handlers = {
* "form" = { * "form" = {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
use Drupal\Core\Url; use Drupal\Core\Url;
/** /**
* Form controller for the aggregator feed edit forms. * Form handler for the aggregator feed edit forms.
*/ */
class FeedForm extends ContentEntityForm { class FeedForm extends ContentEntityForm {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Render controller for aggregator feed items. * View builder handler for aggregator feeds.
*/ */
class FeedViewBuilder extends EntityViewBuilder { class FeedViewBuilder extends EntityViewBuilder {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
use Drupal\Core\Entity\EntityViewBuilder; use Drupal\Core\Entity\EntityViewBuilder;
/** /**
* Render controller for aggregator feed items. * View builder handler for aggregator feed items.
*/ */
class ItemViewBuilder extends EntityViewBuilder { class ItemViewBuilder extends EntityViewBuilder {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; 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 { class BlockContentForm extends ContentEntityForm {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
use Drupal\Core\Entity\EntityViewBuilder; use Drupal\Core\Entity\EntityViewBuilder;
/** /**
* Render controller for custom blocks. * View builder handler for custom blocks.
*/ */
class BlockContentViewBuilder extends EntityViewBuilder { class BlockContentViewBuilder extends EntityViewBuilder {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Base for controller for comment forms. * Base handler for comment forms.
*/ */
class CommentForm extends ContentEntityForm { class CommentForm extends ContentEntityForm {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; 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, * This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class,
* adding required special handling for comment entities. * adding required special handling for comment entities.
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Base form controller for category edit forms. * Base form handler for comment type edit forms.
*/ */
class CommentTypeForm extends EntityForm { class CommentTypeForm extends EntityForm {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Render controller for comments. * View builder handler for comments.
*/ */
class CommentViewBuilder extends EntityViewBuilder { class CommentViewBuilder extends EntityViewBuilder {
......
...@@ -130,14 +130,14 @@ public function render() { ...@@ -130,14 +130,14 @@ public function render() {
} }
/** /**
* Filters entities based on their controllers. * Filters entities based on their view builder handlers.
* *
* @param $entity_type * @param $entity_type
* The entity type of the entity that needs to be validated. * The entity type of the entity that needs to be validated.
* *
* @return bool * @return bool
* TRUE if the entity has the correct controller, FALSE if the entity * TRUE if the entity has the correct view builder handler, FALSE if the
* doesn't has the correct controller. * entity doesn't have the correct view builder handler.
*/ */
protected function isValidEntity($entity_type) { protected function isValidEntity($entity_type) {
return $this->entityTypes[$entity_type]->get('field_ui_base_route') && $this->entityTypes[$entity_type]->hasViewBuilderClass(); return $this->entityTypes[$entity_type]->get('field_ui_base_route') && $this->entityTypes[$entity_type]->hasViewBuilderClass();
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
class EntityFormModeListBuilder extends EntityDisplayModeListBuilder { class EntityFormModeListBuilder extends EntityDisplayModeListBuilder {
/** /**
* Filters entities based on their controllers. * Filters entities based on their form mode handlers.
* *
* @param $entity_type * @param $entity_type
* The entity type of the entity that needs to be validated. * The entity type of the entity that needs to be validated.
......
...@@ -61,7 +61,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI ...@@ -61,7 +61,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition. * The entity type definition.
* @param \Drupal\Core\Entity\EntityStorageInterface $storage * @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The entity storage controller class. * The entity storage handler class.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager. * The language manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Form controller for the node edit forms. * Form handler for the node edit forms.
*/ */
class NodeForm extends ContentEntityForm { class NodeForm extends ContentEntityForm {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use Drupal\Core\Session\AccountInterface; 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. * This is used to build node query access.
* *
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
use Drupal\Core\Language\LanguageInterface; 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 * This extends the base storage class, adding required special handling for
* node entities. * node entities.
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Form controller for node type forms. * Form handler for node type forms.
*/ */
class NodeTypeForm extends BundleEntityFormBase { class NodeTypeForm extends BundleEntityFormBase {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
use Drupal\node\Entity\Node; use Drupal\node\Entity\Node;
/** /**
* Render controller for nodes. * View builder handler for nodes.
*/ */
class NodeViewBuilder extends EntityViewBuilder { class NodeViewBuilder extends EntityViewBuilder {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
class Type extends StringArgument { class Type extends StringArgument {
/** /**
* NodeType storage controller. * NodeType storage handler.
* *
* @var \Drupal\Core\Entity\EntityStorageInterface * @var \Drupal\Core\Entity\EntityStorageInterface
*/ */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
/** /**
* Form controller for the shortcut entity forms. * Form handler for the shortcut entity forms.
*/ */
class ShortcutForm extends ContentEntityForm { class ShortcutForm extends ContentEntityForm {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
use Drupal\Core\Form\FormStateInterface; 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 { class ShortcutSetForm extends BundleEntityFormBase {
......
...@@ -27,7 +27,7 @@ class OverviewTerms extends FormBase { ...@@ -27,7 +27,7 @@ class OverviewTerms extends FormBase {
protected $moduleHandler; protected $moduleHandler;
/** /**
* The term storage controller. * The term storage handler.
* *
* @var \Drupal\taxonomy\TermStorageInterface * @var \Drupal\taxonomy\TermStorageInterface
*/ */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
use Drupal\Core\Form\FormStateInterface; 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 { class TermForm extends ContentEntityForm {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
use Drupal\Core\Entity\EntityViewBuilder; use Drupal\Core\Entity\EntityViewBuilder;
/** /**
* Render controller for taxonomy terms. * View builder handler for taxonomy terms.
*/ */
class TermViewBuilder extends EntityViewBuilder { class TermViewBuilder extends EntityViewBuilder {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
use Drupal\Core\Config\Entity\ConfigEntityStorage; 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 { class VocabularyStorage extends ConfigEntityStorage implements VocabularyStorageInterface {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Language\LanguageManagerInterface;
/** /**
* Form controller for the profile forms. * Form handler for the profile forms.
*/ */
class ProfileForm extends AccountForm { class ProfileForm extends AccountForm {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Language\LanguageManagerInterface;
/** /**
* Form controller for the user register forms. * Form handler for the user register forms.
*/ */
class RegisterForm extends AccountForm { class RegisterForm extends AccountForm {
......
...@@ -28,7 +28,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac ...@@ -28,7 +28,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
use StringTranslationTrait; use StringTranslationTrait;
/** /**
* Entity type for this views controller instance. * Entity type for this views data handler instance.
* *
* @var \Drupal\Core\Entity\EntityTypeInterface * @var \Drupal\Core\Entity\EntityTypeInterface
*/ */
...@@ -68,7 +68,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac ...@@ -68,7 +68,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type to provide views integration for. * The entity type to provide views integration for.
* @param \Drupal\Core\Entity\Sql\SqlEntityStorageInterface $storage_controller * @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 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager. * The entity manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment