You are here

function ffc_condition_form_rules_event in Field formatter conditions 7

Field formatter conditional form.

Present the Rules selection form.

File

./ffc.ffc_conditions_info.inc, line 424
Hook implementations and API functions for Field formatter settings.

Code

function ffc_condition_form_rules_event($context, $configuration) {
  $form = array();
  $rule_options = array();
  $rules = entity_load('rules_config', FALSE, array(
    'plugin' => 'reaction rule',
    'active' => TRUE,
    'event' => 'field_is_rendered',
  ));
  foreach ($rules as $key => $rule) {
    $rule_options[$rule->name] = $rule->label;
  }
  $form['rule'] = array(
    '#type' => 'select',
    '#title' => t('Select a rule to execute'),
    '#options' => $rule_options,
    '#default_value' => isset($configuration['rule']) ? $configuration['rule'] : '',
    '#description' => t('Only rules from the "Field formatter conditions" group are supported.'),
  );
  return $form;
}