You are here

function entity_forms in Entity API 7

Implements hook_forms().

See also

EntityDefaultUIController::hook_forms()

entity_ui_get_form()

File

./entity.module, line 1218

Code

function entity_forms($form_id, $args) {

  // For efficiency only invoke an entity types controller, if a form of it is
  // requested. Thus if the first (overview and operation form) or the third
  // argument (edit form) is an entity type name, add in the types forms.
  if (isset($args[0]) && is_string($args[0]) && entity_get_info($args[0])) {
    $type = $args[0];
  }
  elseif (isset($args[2]) && is_string($args[2]) && entity_get_info($args[2])) {
    $type = $args[2];
  }
  if (isset($type) && ($controller = entity_ui_controller($type))) {
    return $controller
      ->hook_forms();
  }
}