You are here

abstract class RulesFormsDataUI in Rules Forms Support 7

Extends data to be used by Rules.

Hierarchy

Expanded class hierarchy of RulesFormsDataUI

File

includes/rules_forms.ui.inc, line 11
Defines data type classes for forms and form elements.

View source
abstract class RulesFormsDataUI extends RulesDataUI implements RulesDataDirectInputFormInterface {

  /**
   * Provides the default mode.
   */
  public static function getDefaultMode() {
    return 'input';
  }

  /**
   * Provides the default form.
   */
  public static function defaultForm($name, $info, $settings, $title, $type = 'select') {
    $form[$name] = array(
      '#type' => $type,
      '#title' => $title,
      '#default_value' => isset($settings[$name]) ? $settings[$name] : NULL,
      '#required' => empty($info['optional']),
    );
    return $form;
  }

  /**
   * Renders a parameter value.
   */
  public static function render($value) {
    return array(
      'content' => array(
        '#markup' => check_plain($value),
      ),
      '#attributes' => array(
        'class' => array(
          'rules-forms-parameter',
        ),
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RulesDataDirectInputFormInterface::inputForm public static function Constructs the direct input form. 2
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.
RulesFormsDataUI::defaultForm public static function Provides the default form.
RulesFormsDataUI::getDefaultMode public static function Provides the default mode. Overrides RulesDataUI::getDefaultMode
RulesFormsDataUI::render public static function Renders a parameter value. Overrides RulesDataDirectInputFormInterface::render