You are here

function inline_conditions_get_info in Inline Conditions 7

Returns the info array of a condition.

Parameters

string $condition_name: The condition name for which the info shall be returned, or NULL to return an array with info about all conditions.

Return value

array An array of conditions.

4 calls to inline_conditions_get_info()
inline_conditions_build in ./inline_conditions.module
Defines a callback to add condition(s) to the given rule.
inline_conditions_get_info_by_module in ./inline_conditions.module
Get inline conditions per module name.
inline_conditions_get_info_by_type in ./inline_conditions.module
Get inline conditions per type.
inline_conditions_rules_condition_info in ./inline_conditions.rules.inc
Implements hook_rules_condition_info().
2 string references to 'inline_conditions_get_info'
inline_conditions_modules_disabled in ./inline_conditions.module
Implements hook_modules_disabled().
inline_conditions_modules_enabled in ./inline_conditions.module
Implements hook_modules_enabled().

File

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

Code

function inline_conditions_get_info($condition_name = NULL) {
  $conditions =& drupal_static(__FUNCTION__);
  if (!isset($conditions)) {
    $conditions = array();
    foreach (module_implements('inline_conditions_info') as $module) {
      foreach (module_invoke($module, 'inline_conditions_info') as $condition => $condition_info) {
        $condition_info += array(
          // Remember the providing module.
          'module' => $module,
          'callbacks' => array(),
        );

        // Provide default callbacks based on condition name when they are using
        // the MODULE_CONDITION condition name's naming pattern.
        $callback_prefix = $condition;
        if (strpos($callback_prefix, $module . '_') !== 0) {
          $callback_prefix = $module . '_' . $condition;
        }
        $condition_info['callbacks'] += array(
          'configure' => $callback_prefix . '_configure',
          'build' => $callback_prefix . '_build',
        );
        $conditions[$condition] = $condition_info;
      }
    }
    drupal_alter('inline_conditions_info', $conditions);
  }
  if (isset($condition_name)) {
    return !empty($conditions[$condition_name]) ? $conditions[$condition_name] : FALSE;
  }
  else {
    return $conditions;
  }
}