public EntityTypeManager::getFormObject($entity_type, $operation)
Creates a new form instance.
Parameters
string $entity_type: The entity type for this form.
string $operation: The name of the operation to use, e.g., 'default'.
Return value
\Drupal\Core\Entity\EntityFormInterface A form instance.
Overrides EntityTypeManagerInterface::getFormObject
File
- core/lib/Drupal/Core/Entity/EntityTypeManager.php, line 182
Class
- EntityTypeManager
- Manages entity type plugin definitions.
Namespace
Drupal\Core\Entity
Code
public function getFormObject($entity_type, $operation) { 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)); } $form_object = $this->classResolver->getInstanceFromDefinition($class); return $form_object ->setStringTranslation($this->stringTranslation) ->setModuleHandler($this->moduleHandler) ->setEntityTypeManager($this) ->setOperation($operation) // The entity manager cannot be injected due to a circular dependency. // @todo Remove this set call in https://www.drupal.org/node/2603542. ->setEntityManager(\Drupal::entityManager()); }
Please login to continue.