You are here

function flag_rules_data_type::get_default_input_form in Flag 6

Same name and namespace in other branches
  1. 6.2 includes/flag.rules.inc \flag_rules_data_type::get_default_input_form()

Returns radios for selecting a flag of the type given in $info['flag_type'].

Overrides rules_data_type::get_default_input_form

File

includes/flag.rules.inc, line 50
flag.rules.inc Rules integration for the Flag module.

Class

flag_rules_data_type
Defines the flag rule data type.

Code

function get_default_input_form($info, $value, &$form_state) {
  $options = _flag_rules_flags_options(isset($info['flag_type']) ? $info['flag_type'] : NULL);
  $form = array(
    '#type' => 'radios',
    '#title' => $info['label'],
    '#options' => $options,
    '#required' => TRUE,
    '#disabled' => !$options,
    '#default_value' => isset($value) ? $value : NULL,
    '#theme' => 'flag_rules_radios',
    '#printed' => TRUE,
  );
  if (!$options) {
    $form['#description'] = t('Error: There is no suiting flag available.');
  }
  return $form;
}