function registration_states in Entity Registration 7.2
Same name and namespace in other branches
- 8.2 registration.module \registration_states()
- 8 registration.module \registration_states()
- 7 registration.module \registration_states()
Return all registration state entities.
Parameters
array $conditions - key => value array of properties and conditions: that restrict what registration_state entities will be returned
Return value
array An array of registration state entities.
5 calls to registration_states()
- registration_get_active_states in ./
registration.module - Return an array of all active state machine names.
- registration_get_default_state in ./
registration.module - Return default state
- registration_get_held_states in ./
registration.module - Return an array of all held state machine names.
- registration_get_states_options in ./
registration.module - Get an array of states structured as options for a form select elements
- registration_state_overview_form in includes/
registration.forms.inc - Registration states setting form.
File
- ./
registration.module, line 1701
Code
function registration_states($conditions = array()) {
$states =& drupal_static(__FUNCTION__ . serialize($conditions), array());
if (!empty($states)) {
return $states;
}
$entity_type = 'registration_state';
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', $entity_type)
->propertyOrderBy('weight', 'ASC');
foreach ($conditions as $col => $val) {
$query
->propertyCondition($col, $val);
}
if ($results = $query
->execute()) {
$states = entity_load($entity_type, array_keys($results[$entity_type]));
}
return $states;
}