You are here

class RulesDataUINumberBoolean in Boolean Field 7

UI for boolean data.

Hierarchy

Expanded class hierarchy of RulesDataUINumberBoolean

1 string reference to 'RulesDataUINumberBoolean'
boolean_rules_data_info in ./boolean.rules.inc
Implements hook_rules_data_info().

File

./boolean.rules.inc, line 26
Provides integration with Rules module.

View source
class RulesDataUINumberBoolean extends RulesDataUI implements RulesDataDirectInputFormInterface {
  public static function getDefaultMode() {
    return 'input';
  }
  public static function inputForm($name, $info, $settings, RulesPlugin $element) {
    $settings += array(
      $name => isset($info['default value']) ? $info['default value'] : NULL,
    );
    $form[$name] = array(
      '#type' => 'select',
      '#options' => boolean_value_info(),
      '#default_value' => $settings[$name],
    );
    return $form;
  }
  public static function render($value) {
    $states = boolean_value_info();
    return array(
      'content' => array(
        '#markup' => $states[$value],
      ),
      '#attributes' => array(
        'class' => array(
          'rules-parameter-number-boolean',
        ),
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RulesDataUI::getTypeInfo public static function Returns the data type and parameter information for the given arguments.
RulesDataUI::renderOptionsLabel public static function Renders the value with a label if an options list is available.
RulesDataUI::selectionForm public static function Provides the selection form for a parameter.
RulesDataUINumberBoolean::getDefaultMode public static function Specifies the default input mode per data type. Overrides RulesDataUI::getDefaultMode
RulesDataUINumberBoolean::inputForm public static function Constructs the direct input form. Overrides RulesDataDirectInputFormInterface::inputForm
RulesDataUINumberBoolean::render public static function Render the configured value. Overrides RulesDataDirectInputFormInterface::render