You are here

public static function RulesDataUIBoolean::inputForm in Rules 7.2

Implements RulesDataDirectInputFormInterface::inputForm().

Overrides RulesDataDirectInputFormInterface::inputForm

File

ui/ui.data.inc, line 368
Contains data type related forms.

Class

RulesDataUIBoolean
UI for boolean data.

Code

public static function inputForm($name, $info, $settings, RulesPlugin $element) {
  $settings += array(
    $name => isset($info['default value']) ? $info['default value'] : NULL,
  );

  // Note: Due to the checkbox even optional parameter always receive a value.
  $form[$name] = array(
    '#type' => 'radios',
    '#default_value' => $settings[$name],
    '#options' => array(
      TRUE => t('@label: True.', array(
        '@label' => $info['label'],
      )),
      FALSE => t('@label: False.', array(
        '@label' => $info['label'],
      )),
    ),
  );
  return $form;
}