function entity_form_id

Returns the form id for the given entity and operation.

Parameters

EntityInterface $entity: The entity to be created or edited.

$operation: (optional) The operation for the form to be processed.

Return value

A string representing the entity form id.

3 calls to entity_form_id()
entity_form_submit in drupal/core/includes/entity.inc
Retrieves, populates, and processes an entity form.
entity_get_form in drupal/core/includes/entity.inc
Returns the built and processed entity form for the given entity.
translation_entity_add_page in drupal/core/modules/translation_entity/translation_entity.pages.inc
Page callback for the translation addition page.

File

drupal/core/includes/entity.inc, line 379
Entity API for handling entities like nodes or users.

Code

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';
}