Returns an entity form controller for the given operation.
Since there might be different scenarios in which an entity is edited, multiple form controllers suitable to the different operations may be defined. If no controller is found for the default operation, the base class will be used. If a non-existing non-default operation is specified an exception will be thrown.
$entity_type: The type of the entity.
$operation: (optional) The name of an operation, such as creation, editing or deletion, identifying the controlled form. Defaults to 'default' which is the usual create/edit form.
Drupal\Core\Entity\EntityFormControllerInterface An entity form controller instance.
\Drupal\Core\Entity\EntityManager
function entity_form_controller($entity_type, $operation = 'default') {
return Drupal::entityManager()
->getFormController($entity_type, $operation);
}