You are here

function rb_misc_conditions_build_required_contexts in Rules Bonus Pack 7

Helper function building required CTools contexts for each Rules condition.

Parameters

$component: The condition component. (These are actually entities!)

Return value

ctools_context_required An array of ctools_context_required objects, as used by CTools access plugins.

1 call to rb_misc_conditions_build_required_contexts()
rb_misc_condition_get_plugin_info in plugins/access/rb_misc_conditions.inc
Gets plugin information for a single component.

File

plugins/access/rb_misc_conditions.inc, line 32
Plugin to create access plugins from Rules condition components.

Code

function rb_misc_conditions_build_required_contexts($component) {

  // If there was an entry in the returned components, get the first (and
  // hopefully only) one.
  $parameters = $component
    ->parameterInfo();

  // Build an array on the form used by CTools to declare required contexts.
  $required_contexts = array();
  foreach ($parameters as $parameter) {
    $required_contexts[] = new ctools_context_required(check_plain($parameter['label']), $parameter['type']);
  }
  return $required_contexts;
}