You are here

function entity_ui_controller in Entity API 7

Determines the UI controller class for a given entity type.

Return value

EntityDefaultUIController If a type is given, the controller for the given entity type. Else an array of all enabled UI controllers keyed by entity type is returned.

4 calls to entity_ui_controller()
entity_form in ./entity.module
Gets the edit form for any entity.
entity_forms in ./entity.module
Implements hook_forms().
entity_menu in ./entity.module
Implements hook_menu().
entity_type_supports in ./entity.module
Determines whether for the given entity type a given operation is available.

File

./entity.module, line 1178

Code

function entity_ui_controller($type = NULL) {
  $static =& drupal_static(__FUNCTION__);
  if (!isset($type)) {

    // Invoke the function for each type to ensure we have fully populated the
    // static variable.
    foreach (entity_get_info() as $entity_type => $info) {
      entity_ui_controller($entity_type);
    }
    return array_filter($static);
  }
  if (!isset($static[$type])) {
    $info = entity_get_info($type);
    $class = isset($info['admin ui']['controller class']) ? $info['admin ui']['controller class'] : 'EntityDefaultUIController';
    $static[$type] = isset($info['admin ui']['path']) && $class ? new $class($type, $info) : FALSE;
  }
  return $static[$type];
}