diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index 067fe17..6982a26 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -46,6 +46,7 @@ public function __construct($operation = NULL) { * The name of the current operation. */ public function setOperation($operation) { + // If NULL is passed, do not overwrite the operation. if ($operation) { $this->operation = $operation; } diff --git a/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php b/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php index 8237ba1..79ef787 100644 --- a/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php @@ -16,7 +16,7 @@ class HtmlEntityFormController extends HtmlFormController { /** - * {@inheritdoc} + * Overrides \Drupal\Core\HtmlFormController::content(). * * Due to reflection, the argument must be named $_entity_form. The parent * method has $request and $_form, but the parameter must match the route. @@ -28,8 +28,8 @@ public function content(Request $request, $_entity_form) { /** * Overrides \Drupal\Core\HtmlFormController::getFormObject(). * - * Instead of a class name or service ID, $form_arg will be a string representing - * the entity and operation being performed. + * Instead of a class name or service ID, $form_arg will be a string + * representing the entity and operation being performed. * Consider the following route: * @code * pattern: '/foo/{node}/bar' @@ -50,16 +50,16 @@ protected function getFormObject(Request $request, $form_arg) { // If no operation is provided, use 'default'. $form_arg .= '.default'; - list ($entity, $operation) = explode('.', $form_arg); + list ($entity_type, $operation) = explode('.', $form_arg); - if ($request->attributes->has($entity)) { - $entity = $request->attributes->get($entity); + if ($request->attributes->has($entity_type)) { + $entity = $request->attributes->get($entity_type); } else { - $entity = $manager->getStorageController($entity)->create(array()); + $entity = $manager->getStorageController($entity_type)->create(array()); } - return $manager->getFormController($entity->entityType(), $operation)->setEntity($entity); + return $manager->getFormController($entity_type, $operation)->setEntity($entity); } }