class RulesDataUIBoolean

UI for boolean data.

Hierarchy

Expanded class hierarchy of RulesDataUIBoolean

1 string reference to 'RulesDataUIBoolean'
rules_rules_core_data_info in modules/rules_core.rules.inc
Implements hook_rules_data_info() on behalf of the pseudo rules_core module.

File

ui/ui.data.inc, line 356

View source
class RulesDataUIBoolean extends RulesDataUI implements RulesDataDirectInputFormInterface {
    
    /**
     * Overrides RulesDataUI::getDefaultMode().
     */
    public static function getDefaultMode() {
        return 'input';
    }
    
    /**
     * Implements RulesDataDirectInputFormInterface::inputForm().
     */
    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;
    }
    
    /**
     * Implements RulesDataDirectInputFormInterface::render().
     */
    public static function render($value) {
        return array(
            'content' => array(
                '#markup' => !empty($value) ? t('true') : t('false'),
            ),
            '#attributes' => array(
                'class' => array(
                    'rules-parameter-boolean',
                ),
            ),
        );
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
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.
RulesDataUIBoolean::getDefaultMode public static function Overrides RulesDataUI::getDefaultMode(). Overrides RulesDataUI::getDefaultMode
RulesDataUIBoolean::inputForm public static function Implements RulesDataDirectInputFormInterface::inputForm(). Overrides RulesDataDirectInputFormInterface::inputForm
RulesDataUIBoolean::render public static function Implements RulesDataDirectInputFormInterface::render(). Overrides RulesDataDirectInputFormInterface::render