You are here

function inline_conditions_get_info_by_type in Inline Conditions 7

Get inline conditions per type.

Return an array of defined inline conditions for the passed entity type and component type (if specified by the condition).

Parameters

string $entity_type: The type of the entity available to the rule.

string $parent_entity_type: The type of the parent entity (that contains the IC field). Used for comparison if a condition defines one as well.

Return value

array An array of conditions.

1 call to inline_conditions_get_info_by_type()
inline_conditions_field_widget_form in ./inline_conditions.field.inc
Implements hook_field_widget_form().

File

./inline_conditions.module, line 489
Extends Drupal 7 with a new field type to manage rules conditions directly from a field.

Code

function inline_conditions_get_info_by_type($entity_type, $parent_entity_type) {
  $conditions = inline_conditions_get_info();

  // Prepare the list of conditions to be returned.
  // Filter first by entity type, then by parent entity type, if available.
  $filtered_conditions = array();
  foreach ($conditions as $condition_name => $condition_info) {
    if ($condition_info['entity type'] != $entity_type) {
      continue;
    }
    if (isset($condition_info['parent entity type']) && $condition_info['parent entity type'] != $parent_entity_type) {
      continue;
    }
    $filtered_conditions[$condition_name] = $condition_info;
  }
  return $filtered_conditions;
}