class RulesDataUIText

UI for textual data.

Hierarchy

Expanded class hierarchy of RulesDataUIText

1 string reference to 'RulesDataUIText'
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 191

View source
class RulesDataUIText 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) {
    if (!empty($info['options list'])) {
      // Make sure the .rules.inc of the providing module is included as the
      // options list callback may reside there.
      $element->call('loadBasicInclude');
      $form[$name] = array(
        '#type' => 'select',
        '#options' => call_user_func($info['options list'], $element, $name),
      );
    }
    else {
      $form[$name] = array(
        '#type' => 'textarea',
        '#rows' => 3,
      );
      RulesDataInputEvaluator::attachForm($form, $settings, $info, $element->availableVariables());
    }
    $settings += array(
      $name => isset($info['default value']) ? $info['default value'] : NULL,
    );
    $form[$name] += array(
      '#title' => t('Value'),
      '#default_value' => $settings[$name],
      '#required' => empty($info['optional']),
      '#after_build' => array(
        'rules_ui_element_fix_empty_after_build',
      ),
    );
    return $form;
  }
  
  /**
   * Implements RulesDataDirectInputFormInterface::render().
   */
  public static function render($value) {
    return array(
      'content' => array(
        '#markup' => check_plain($value),
      ),
      '#attributes' => array(
        'class' => array(
          'rules-parameter-text',
        ),
      ),
    );
  }

}

Members

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