You are here

public static function FlagRulesUIClass::inputForm in Flag 7.2

Same name and namespace in other branches
  1. 7.3 flag.rules.inc \FlagRulesUIClass::inputForm()

Constructs the direct input form.

Return value

array The direct input form.

Overrides RulesDataDirectInputFormInterface::inputForm

File

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

Class

FlagRulesUIClass
UI for inputing flags.

Code

public static function inputForm($name, $info, $settings, RulesPlugin $element) {
  $options = _flag_rules_flags_options(isset($info['flag_type']) ? $info['flag_type'] : NULL);
  $header = array(
    'title' => t('Flag:'),
    'type' => t('The flag type'),
    'global' => t('Is the flag global?'),
  );
  $settings += array(
    $name => isset($info['default value']) ? $info['default value'] : '',
  );
  $form[$name] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#required' => empty($info['optional']),
    '#multiple' => FALSE,
    '#default_value' => $settings[$name],
    '#empty' => t('There is no suiting flag available.'),
  );
  return $form;
}