You are here

public function UserVariable::buildForm in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesVariable/UserVariable.php \Drupal\business_rules\Plugin\BusinessRulesVariable\UserVariable::buildForm()

Form constructor.

Give a chance to plugin to change the buildForm method.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

Overrides BusinessRulesItemPluginBase::buildForm

File

src/Plugin/BusinessRulesVariable/UserVariable.php, line 67

Class

UserVariable
A variable representing one user account.

Namespace

Drupal\business_rules\Plugin\BusinessRulesVariable

Code

public function buildForm(array &$form, FormStateInterface $form_state) {
  $form['settings']['context']['target_entity_type']['#value'] = 'user';
  $form['settings']['context']['target_entity_type']['#options'] = [
    'user' => $form['settings']['context']['target_entity_type']['#options']['user'],
  ];
  $form['settings']['context']['target_entity_type']['#disabled'] = TRUE;
  $form['settings']['context']['target_bundle']['#options'] = [
    'user' => t('User'),
  ];
  $form['settings']['context']['target_bundle']['#value'] = 'user';
  $form['settings']['context']['target_bundle']['#disabled'] = TRUE;
}