Returns the form id for the given entity and operation.
EntityInterface $entity: The entity to be created or edited.
$operation: (optional) The operation for the form to be processed.
A string representing the entity form id.
function entity_form_id(EntityInterface $entity, $operation = 'default') {
$entity_type = $entity
->entityType();
$bundle = $entity
->bundle();
$form_id = $entity_type;
if ($bundle != $entity_type) {
$form_id = $bundle . '_' . $form_id;
}
if ($operation != 'default') {
$form_id = $form_id . '_' . $operation;
}
return $form_id . '_form';
}