You are here

function sarnia_entity_types in Sarnia 7

Same name in this branch
  1. 7 sarnia.api.php \sarnia_entity_types()
  2. 7 sarnia.module \sarnia_entity_types()

Get information about all Sarnia-provided entities.

This function loads entity information using entity_get_info(), filters on the entity controller class property, and returns just the bundle information.

Return value

array An array whose keys are entity type names and values are entity bundle info arrays.

6 calls to sarnia_entity_types()
sarnia_entity_server_name_load in ./sarnia.module
Get a Sarnia entity type machine name given a Search API server machine name.
sarnia_entity_type_load in ./sarnia.module
Load bundle information about a specific Sarnia entity type.
sarnia_entity_type_load_by_index in ./sarnia.module
Load Sarnia entity type info given a Search API index machine name.
sarnia_field_extra_fields in ./sarnia.module
Implements hook_field_extra_fields().
sarnia_menu_alter in ./sarnia.module
Implements hook_menu_alter().

... See full list

File

./sarnia.module, line 194

Code

function sarnia_entity_types($reset = FALSE) {
  $entity_types =& drupal_static(__FUNCTION__);
  if (!isset($entity_types) || $reset) {

    // Find entities that use the Sarnia controller.
    $entity_types = array();
    foreach (entity_get_info() as $type_name => $type) {
      if ($type['controller class'] == 'SarniaController') {

        // Extract the entity's bundle information.
        $entity_types[$type_name] = $type['bundles'][$type_name];
      }
    }
  }
  return $entity_types;
}