You are here

public static function RulesDataUIEntity::inputForm in Rules 7.2

Implements RulesDataDirectInputFormInterface::inputForm().

Overrides RulesDataUIText::inputForm

File

ui/ui.data.inc, line 587
Contains data type related forms.

Class

RulesDataUIEntity
UI for entity-based data types.

Code

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;
}