You are here

function registration_states in Entity Registration 8

Same name and namespace in other branches
  1. 8.2 registration.module \registration_states()
  2. 7.2 registration.module \registration_states()
  3. 7 registration.module \registration_states()

Return all registration state entities.

Parameters

bool $active:

bool $show_on_form:

Return value

array An array of registration state entities.

6 calls to registration_states()
registration_event_count in ./registration.module
Determines current number of spaces filled for a host entity.
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

... See full list

File

./registration.module, line 1557

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 = \Drupal::entityManager()
      ->getStorage($entity_type);
  }
  return $states;
}