You are here

class RulesDataUIDuration in Rules 7.2

UI for duration type parameter.

Hierarchy

Expanded class hierarchy of RulesDataUIDuration

1 string reference to 'RulesDataUIDuration'
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 439
Contains data type related forms.

View source
class RulesDataUIDuration extends RulesDataUIText {

  /**
   * Implements RulesDataDirectInputFormInterface::inputForm().
   */
  public static function inputForm($name, $info, $settings, RulesPlugin $element) {
    $form = parent::inputForm($name, $info, $settings, $element);
    $form[$name]['#type'] = 'rules_duration';
    $form[$name]['#after_build'][] = 'rules_ui_element_duration_after_build';
    return $form;
  }

  /**
   * Implements RulesDataDirectInputFormInterface::render().
   */
  public static function render($value) {
    $value = is_numeric($value) ? format_interval($value) : check_plain($value);
    return array(
      'content' => array(
        '#markup' => $value,
      ),
      '#attributes' => array(
        'class' => array(
          'rules-parameter-duration',
        ),
      ),
    );
  }

}

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.
RulesDataUIDuration::inputForm public static function Implements RulesDataDirectInputFormInterface::inputForm(). Overrides RulesDataUIText::inputForm
RulesDataUIDuration::render public static function Implements RulesDataDirectInputFormInterface::render(). Overrides RulesDataUIText::render
RulesDataUIText::getDefaultMode public static function Overrides RulesDataUI::getDefaultMode(). Overrides RulesDataUI::getDefaultMode 2