You are here

function pollim_get_types in Poll Improved 7

Gets an array of all pollim types, keyed by the type name.

Parameters

$type_name: If set, the type with the given name is returned.

Return value

PollimType[] Depending whether $type isset, an array of pollim types or a single one.

4 calls to pollim_get_types()
PollimUIController::hook_menu in ./pollim.admin.inc
Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu() is optimized for entity type administration.
pollim_entity_info_alter in ./pollim.module
Implements hook_entity_info_alter().
pollim_permission in ./pollim.module
Implements hook_permission().
pollim_type_load in ./pollim.module
Menu argument loader; Load a pollim type by string.
1 string reference to 'pollim_get_types'
pollim_type_form in ./pollim_type.admin.inc
Generates the pollim type editing form.

File

./pollim.module, line 194
Module for the Pollim Entity - a starting point to create your own Entity and associated administration interface

Code

function pollim_get_types($type_name = NULL) {

  // entity_load will get the Entity controller for our pollim entity and call the load
  // function of that object - we are loading entities by name here.
  $types = entity_load_multiple_by_name('pollim_type', isset($type_name) ? array(
    $type_name,
  ) : FALSE);
  return isset($type_name) ? reset($types) : $types;
}