You are here

class RulesDataUIEntity in Rules 7.2

UI for entity-based data types.

Hierarchy

Expanded class hierarchy of RulesDataUIEntity

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

View source
class RulesDataUIEntity extends RulesDataUIText {

  /**
   * Overrides RulesDataUI::getDefaultMode().
   */
  public static function getDefaultMode() {
    return 'selector';
  }

  /**
   * Implements RulesDataDirectInputFormInterface::inputForm().
   */
  public static function inputForm($name, $info, $settings, RulesPlugin $element) {
    $form = parent::inputForm($name, $info, $settings, $element);
    if (empty($info['options list'])) {
      $form[$name]['#type'] = 'textfield';
      $entity_info = entity_get_info($info['type']);
      if (empty($entity_info['entity keys']['name'])) {
        $form[$name]['#element_validate'][] = 'rules_ui_element_integer_validate';
      }
      $form[$name]['#title'] = t('@entity identifier', array(
        '@entity' => $entity_info['label'],
      ));
      $entity_label = strtolower($entity_info['label'][0]) . substr($entity_info['label'], 1);
      $form[$name]['#description'] = t('Specify an identifier of a @entity.', array(
        '@entity' => $entity_label,
      ));
    }
    return $form;
  }

}

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