Commit c79ac2f7 authored by alexpott's avatar alexpott

Issue #2238077 by Berdir, alexpott, tim.plunkett: Rename EntityFormController to EntityForm.

parent 3937bda8
......@@ -13,7 +13,7 @@
/**
* Provides a generic base class for an entity-based confirmation form.
*/
abstract class ContentEntityConfirmFormBase extends ContentEntityFormController implements ConfirmFormInterface {
abstract class ContentEntityConfirmFormBase extends ContentEntityForm implements ConfirmFormInterface {
/**
* {@inheritdoc}
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Entity\ContentEntityFormController.
* Contains \Drupal\Core\Entity\ContentEntityForm.
*/
namespace Drupal\Core\Entity;
......@@ -12,11 +12,11 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Entity form controller variant for content entity types.
* Entity form variant for content entity types.
*
* @see \Drupal\Core\ContentEntityBase
*/
class ContentEntityFormController extends EntityFormController implements ContentEntityFormControllerInterface {
class ContentEntityForm extends EntityForm implements ContentEntityFormInterface {
/**
* The entity manager.
......@@ -26,7 +26,7 @@ class ContentEntityFormController extends EntityFormController implements Conten
protected $entityManager;
/**
* Constructs a ContentEntityFormController object.
* Constructs a ContentEntityForm object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Entity\ContentEntityFormControllerInterface.
* Contains \Drupal\Core\Entity\ContentEntityFormInterface.
*/
namespace Drupal\Core\Entity;
......@@ -10,9 +10,9 @@
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
/**
* Defines a common interface for content entity form controller classes.
* Defines a common interface for content entity form classes.
*/
interface ContentEntityFormControllerInterface extends EntityFormControllerInterface {
interface ContentEntityFormInterface extends EntityFormInterface {
/**
* Returns the form display.
......
......@@ -14,7 +14,7 @@
/**
* Provides a generic base class for an entity-based confirmation form.
*/
abstract class EntityConfirmFormBase extends EntityFormController implements ConfirmFormInterface {
abstract class EntityConfirmFormBase extends EntityForm implements ConfirmFormInterface {
/**
* {@inheritdoc}
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Entity\EntityFormController.
* Contains \Drupal\Core\Entity\EntityForm.
*/
namespace Drupal\Core\Entity;
......@@ -12,9 +12,9 @@
use Drupal\Core\Render\Element;
/**
* Base class for entity form controllers.
* Base class for entity forms.
*/
class EntityFormController extends FormBase implements EntityFormControllerInterface {
class EntityForm extends FormBase implements EntityFormInterface {
/**
* The name of the current operation.
......@@ -129,7 +129,7 @@ protected function init(array &$form_state) {
/**
* Returns the actual form array to be built.
*
* @see \Drupal\Core\Entity\EntityFormController::build()
* @see \Drupal\Core\Entity\EntityForm::build()
*/
public function form(array $form, array &$form_state) {
$entity = $this->entity;
......@@ -152,7 +152,7 @@ public function form(array $form, array &$form_state) {
/**
* Process callback: assigns weights and hides extra fields.
*
* @see \Drupal\Core\Entity\EntityFormController::form()
* @see \Drupal\Core\Entity\EntityForm::form()
*/
public function processForm($element, $form_state, $form) {
// If the form is cached, process callbacks may not have a valid reference
......
......@@ -45,14 +45,14 @@ public function __construct(EntityManagerInterface $entity_manager, FormBuilderI
* {@inheritdoc}
*/
public function getForm(EntityInterface $entity, $operation = 'default', array $form_state = array()) {
$controller = $this->entityManager->getFormController($entity->getEntityTypeId(), $operation);
$controller->setEntity($entity);
$form_object = $this->entityManager->getFormObject($entity->getEntityTypeId(), $operation);
$form_object->setEntity($entity);
$form_state['build_info']['callback_object'] = $controller;
$form_state['build_info']['base_form_id'] = $controller->getBaseFormID();
$form_state['build_info']['callback_object'] = $form_object;
$form_state['build_info']['base_form_id'] = $form_object->getBaseFormID();
$form_state['build_info'] += array('args' => array());
return $this->formBuilder->buildForm($controller->getFormId(), $form_state);
return $this->formBuilder->buildForm($form_object->getFormId(), $form_state);
}
}
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Core\Entity\EntityFormControllerInterface.
* Contains \Drupal\Core\Entity\EntityFormInterface.
*/
namespace Drupal\Core\Entity;
......@@ -12,9 +12,9 @@
use Drupal\Core\StringTranslation\TranslationInterface;
/**
* Defines a common interface for entity form controller classes.
* Defines a common interface for entity form classes.
*/
interface EntityFormControllerInterface extends BaseFormIdInterface {
interface EntityFormInterface extends BaseFormIdInterface {
/**
* Returns the code identifying the active form language.
......@@ -49,7 +49,7 @@ public function isDefaultFormLangcode(array $form_state);
public function setOperation($operation);
/**
* Returns the operation identifying the form controller.
* Returns the operation identifying the form.
*
* @return string
* The name of the operation.
......@@ -74,7 +74,7 @@ public function getEntity();
*
* Sets the form entity which will be used for populating form element
* defaults. Usually, the form entity gets updated by
* \Drupal\Core\Entity\EntityFormControllerInterface::submit(), however this may
* \Drupal\Core\Entity\EntityFormInterface::submit(), however this may
* be used to completely exchange the form entity, e.g. when preparing the
* rebuild of a multi-step form.
*
......@@ -92,7 +92,7 @@ public function setEntity(EntityInterface $entity);
* the submitted form values are copied to entity properties. The form's
* entity remains unchanged.
*
* @see \Drupal\Core\Entity\EntityFormControllerInterface::getEntity()
* @see \Drupal\Core\Entity\EntityFormInterface::getEntity()
*
* @param array $form
* A nested array form elements comprising the form.
......
......@@ -217,7 +217,7 @@ public function getListBuilder($entity_type) {
/**
* {@inheritdoc}
*/
public function getFormController($entity_type, $operation) {
public function getFormObject($entity_type, $operation) {
if (!isset($this->controllers['form'][$operation][$entity_type])) {
if (!$class = $this->getDefinition($entity_type, TRUE)->getFormClass($operation)) {
throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type, $operation));
......
......@@ -150,17 +150,17 @@ public function getViewBuilder($entity_type);
public function getListBuilder($entity_type);
/**
* Creates a new form controller instance.
* Creates a new form instance.
*
* @param string $entity_type
* The entity type for this form controller.
* The entity type for this form.
* @param string $operation
* The name of the operation to use, e.g., 'default'.
*
* @return \Drupal\Core\Entity\EntityFormControllerInterface
* A form controller instance.
* @return \Drupal\Core\Entity\EntityFormInterface
* A form instance.
*/
public function getFormController($entity_type, $operation);
public function getFormObject($entity_type, $operation);
/**
* Clears static and persistent field definition caches.
......
......@@ -202,7 +202,7 @@ public function getControllerClass($controller_type);
* operations. The name of the operation is passed also to the form
* controller's constructor, so that one class can be used for multiple
* entity forms when the forms are similar. The classes must implement
* \Drupal\Core\Entity\EntityFormControllerInterface.
* \Drupal\Core\Entity\EntityFormInterface.
* - list: The name of the class that provides listings of the entities. The
* class must implement \Drupal\Core\Entity\EntityListBuilderInterface.
* - render: The name of the class that is used to render the entities. The
......@@ -251,7 +251,7 @@ public function getFormClass($operation);
* The operation to use this form class for.
* @param string $class
* The form class implementing
* \Drupal\Core\Entity\EntityFormControllerInterface.
* \Drupal\Core\Entity\EntityFormInterface.
*
* @return static
*
......
......@@ -53,8 +53,8 @@ public function __construct(ControllerResolverInterface $resolver, EntityManager
* defaults:
* _entity_form: 'node.edit'
* @endcode
* This means that the edit form controller for the node entity will used.
* If the entity type has a default form controller, only the name of the
* This means that the edit form for the node entity will used.
* If the entity type has a default form, only the name of the
* entity {param} needs to be passed:
* @code
* path: '/foo/{node}/baz'
......@@ -74,7 +74,7 @@ protected function getFormObject(Request $request, $form_arg) {
$entity = $this->manager->getStorage($entity_type)->create(array());
}
return $this->manager->getFormController($entity_type, $operation)->setEntity($entity);
return $this->manager->getFormObject($entity_type, $operation)->setEntity($entity);
}
}
......@@ -195,7 +195,7 @@ public function getForm($form_arg);
* storage. The recommended way to ensure that the chosen key doesn't
* conflict with ones used by the Form API or other modules is to use the
* module name as the key name or a prefix for the key name. For example,
* the entity form controller classes use $this->entity in entity forms,
* the entity form classes use $this->entity in entity forms,
* or $form_state['controller']->getEntity() outside the controller, to
* store information about the entity being edited, and this information
* stays available across successive clicks of the "Preview" button (if
......
......@@ -50,8 +50,8 @@ function action_permission() {
function action_entity_type_build(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
$entity_types['action']
->setFormClass('add', 'Drupal\action\ActionAddFormController')
->setFormClass('edit', 'Drupal\action\ActionEditFormController')
->setFormClass('add', 'Drupal\action\ActionAddForm')
->setFormClass('edit', 'Drupal\action\ActionEditForm')
->setFormClass('delete', 'Drupal\action\Form\ActionDeleteForm')
->setListBuilderClass('Drupal\action\ActionListBuilder')
->setLinkTemplate('delete-form', 'action.delete')
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\action\ActionAddFormController.
* Contains \Drupal\action\ActionAddForm.
*/
namespace Drupal\action;
......@@ -13,9 +13,9 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a form controller for action add forms.
* Provides a form for action add forms.
*/
class ActionAddFormController extends ActionFormControllerBase {
class ActionAddForm extends ActionFormBase {
/**
* The action manager.
......@@ -25,7 +25,7 @@ class ActionAddFormController extends ActionFormControllerBase {
protected $actionManager;
/**
* Constructs a new ActionAddFormController.
* Constructs a new ActionAddForm.
*
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The action storage.
......
<?php
/**
* @file
* Contains Drupal\action\ActionEditForm.
*/
namespace Drupal\action;
/**
* Provides a form for action edit forms.
*/
class ActionEditForm extends ActionFormBase {
}
<?php
/**
* @file
* Contains Drupal\action\ActionEditFormController.
*/
namespace Drupal\action;
/**
* Provides a form controller for action edit forms.
*/
class ActionEditFormController extends ActionFormControllerBase {
}
......@@ -2,20 +2,20 @@
/**
* @file
* Contains Drupal\action\ActionEditFormController.
* Contains Drupal\action\ActionEditForm.
*/
namespace Drupal\action;
use Drupal\Core\Entity\EntityFormController;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a base form controller for action forms.
* Provides a base form for action forms.
*/
abstract class ActionFormControllerBase extends EntityFormController {
abstract class ActionFormBase extends EntityForm {
/**
* The action plugin being configured.
......
......@@ -24,7 +24,7 @@
* "storage" = "Drupal\aggregator\FeedStorage",
* "view_builder" = "Drupal\aggregator\FeedViewBuilder",
* "form" = {
* "default" = "Drupal\aggregator\FeedFormController",
* "default" = "Drupal\aggregator\FeedForm",
* "delete" = "Drupal\aggregator\Form\FeedDeleteForm",
* "delete_items" = "Drupal\aggregator\Form\FeedItemsDeleteForm",
* }
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\aggregator\FeedFormController.
* Contains \Drupal\aggregator\FeedForm.
*/
namespace Drupal\aggregator;
use Drupal\Component\Utility\String;
use Drupal\Core\Entity\ContentEntityFormController;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Language\Language;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -16,7 +16,7 @@
/**
* Form controller for the aggregator feed edit forms.
*/
class FeedFormController extends ContentEntityFormController {
class FeedForm extends ContentEntityForm {
/**
* {@inheritdoc}
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\custom_block\CustomBlockFormController.
* Contains \Drupal\custom_block\CustomBlockForm.
*/
namespace Drupal\custom_block;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\ContentEntityFormController;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Language\Language;
......@@ -18,7 +18,7 @@
/**
* Form controller for the custom block edit forms.
*/
class CustomBlockFormController extends ContentEntityFormController {
class CustomBlockForm extends ContentEntityForm {
/**
* The custom block storage.
......@@ -35,7 +35,7 @@ class CustomBlockFormController extends ContentEntityFormController {
protected $languageManager;
/**
* Constructs a CustomBlockFormController object.
* Constructs a CustomBlockForm object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
......@@ -63,7 +63,7 @@ public static function create(ContainerInterface $container) {
}
/**
* Overrides \Drupal\Core\Entity\EntityFormController::prepareEntity().
* Overrides \Drupal\Core\Entity\EntityForm::prepareEntity().
*
* Prepares the custom block object.
*
......@@ -167,7 +167,7 @@ public function form(array $form, array &$form_state) {
}
/**
* Overrides \Drupal\Core\Entity\EntityFormController::submit().
* Overrides \Drupal\Core\Entity\EntityForm::submit().
*
* Updates the custom block object by processing the submitted values.
*
......
......@@ -2,21 +2,21 @@
/**
* @file
* Contains \Drupal\custom_block\CustomBlockTypeFormController.
* Contains \Drupal\custom_block\CustomBlockTypeForm.
*/
namespace Drupal\custom_block;
use Drupal\Core\Entity\EntityFormController;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Base form controller for category edit forms.
* Base form for category edit forms.
*/
class CustomBlockTypeFormController extends EntityFormController {
class CustomBlockTypeForm extends EntityForm {
/**
* Overrides \Drupal\Core\Entity\EntityFormController::form().
* Overrides \Drupal\Core\Entity\EntityForm::form().
*/
public function form(array $form, array &$form_state) {
$form = parent::form($form, $form_state);
......@@ -85,7 +85,7 @@ public function form(array $form, array &$form_state) {
}
/**
* Overrides \Drupal\Core\Entity\EntityFormController::save().
* Overrides \Drupal\Core\Entity\EntityForm::save().
*/
public function save(array $form, array &$form_state) {
$block_type = $this->entity;
......
......@@ -25,10 +25,10 @@
* "list_builder" = "Drupal\custom_block\CustomBlockListBuilder",
* "view_builder" = "Drupal\custom_block\CustomBlockViewBuilder",
* "form" = {
* "add" = "Drupal\custom_block\CustomBlockFormController",
* "edit" = "Drupal\custom_block\CustomBlockFormController",
* "add" = "Drupal\custom_block\CustomBlockForm",
* "edit" = "Drupal\custom_block\CustomBlockForm",
* "delete" = "Drupal\custom_block\Form\CustomBlockDeleteForm",
* "default" = "Drupal\custom_block\CustomBlockFormController"
* "default" = "Drupal\custom_block\CustomBlockForm"
* },
* "translation" = "Drupal\custom_block\CustomBlockTranslationHandler"
* },
......
......@@ -19,9 +19,9 @@
* label = @Translation("Custom block type"),
* controllers = {
* "form" = {
* "default" = "Drupal\custom_block\CustomBlockTypeFormController",
* "add" = "Drupal\custom_block\CustomBlockTypeFormController",
* "edit" = "Drupal\custom_block\CustomBlockTypeFormController",
* "default" = "Drupal\custom_block\CustomBlockTypeForm",
* "add" = "Drupal\custom_block\CustomBlockTypeForm",
* "edit" = "Drupal\custom_block\CustomBlockTypeForm",
* "delete" = "Drupal\custom_block\Form\CustomBlockTypeDeleteForm"
* },
* "list_builder" = "Drupal\custom_block\CustomBlockTypeListBuilder"
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\block\BlockFormController.
* Contains \Drupal\block\BlockForm.
*/
namespace Drupal\block;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityFormController;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageManagerInterface;
......@@ -17,9 +17,9 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides form controller for block instance forms.
* Provides form for block instance forms.
*/
class BlockFormController extends EntityFormController {
class BlockForm extends EntityForm {
/**
* The block entity.
......@@ -50,7 +50,7 @@ class BlockFormController extends EntityFormController {
protected $configFactory;
/**
* Constructs a BlockFormController object.
* Constructs a BlockForm object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
......
......@@ -26,7 +26,7 @@
* "view_builder" = "Drupal\block\BlockViewBuilder",
* "list_builder" = "Drupal\block\BlockListBuilder",
* "form" = {
* "default" = "Drupal\block\BlockFormController",
* "default" = "Drupal\block\BlockForm",
* "delete" = "Drupal\block\Form\BlockDeleteForm"
* }
* },
......
......@@ -158,7 +158,7 @@ public function testCandidateBlockList() {
}
/**
* Tests that the BlockFormController populates machine name correctly.
* Tests that the BlockForm populates machine name correctly.
*/
public function testMachineNameSuggestion() {
$url = 'admin/structure/block/add/test_block_instantiation/stark';
......
......@@ -2,25 +2,25 @@
/**
* @file
* Contains \Drupal\block\Tests\BlockFormControllerTest.
* Contains \Drupal\block\Tests\BlockFormTest.
*/
namespace Drupal\block\Tests;
use Drupal\block\BlockFormController;
use Drupal\block\BlockForm;
use Drupal\Tests\UnitTestCase;
/**
* Tests the block form controller.
* Tests the block form.
*
* @see \Drupal\block\BlockFormController
* @see \Drupal\block\BlockForm
*/
class BlockFormControllerTest extends UnitTestCase {
class BlockFormTest extends UnitTestCase {
public static function getInfo() {
return array(
'name' => 'Block form controller',
'description' => 'Tests the block form controller.',
'name' => 'Block form',
'description' => 'Tests the block form.',
'group' => 'Block',
);
}
......@@ -28,7 +28,7 @@ public static function getInfo() {
/**
* Tests the unique machine name generator.
*
* @see \Drupal\block\BlockFormController::getUniqueMachineName()
* @see \Drupal\block\BlockForm::getUniqueMachineName()
*/
public function testGetUniqueMachineName() {
$blocks = array();
......@@ -62,7 +62,7 @@ public function testGetUniqueMachineName() {
$config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
$block_form_controller = new BlockFormController($entity_manager, $language_manager, $config_factory);
$block_form_controller = new BlockForm($entity_manager, $language_manager, $config_factory);
// Ensure that the block with just one other instance gets the next available
// name suggestion.
......
......@@ -8,14 +8,14 @@
namespace Drupal\book\Form;
use Drupal\book\BookManagerInterface;
use Drupal\Core\Entity\ContentEntityFormController;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Displays the book outline form.
*/
class BookOutlineForm extends ContentEntityFormController {
class BookOutlineForm extends ContentEntityForm {
/**
* The book being displayed.
......
......@@ -13,7 +13,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Temporary form controller for book module.
* Remove form for book module.
*/
class BookRemoveForm extends ConfirmFormBase {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\comment\CommentFormController.
* Definition of Drupal\comment\CommentForm.
*/
namespace Drupal\comment;
......@@ -12,7 +12,7 @@
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Entity\ContentEntityFormController;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Session\AccountInterface;
......@@ -22,7 +22,7 @@
/**
* Base for controller for comment forms.
*/
class CommentFormController extends ContentEntityFormController {
class CommentForm extends ContentEntityForm {
/**
* The field info service.
......@@ -50,7 +50,7 @@ public static function create(ContainerInterface $container) {
}