You are here

public function EntityFieldVariable::getSettingsForm in Business Rules 8

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

Return the form array.

@internal param array $form

Parameters

array $form: The form array.

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

\Drupal\business_rules\ItemInterface $item: The configured item.

Return value

array The render array for the settings form.

Overrides BusinessRulesItemPluginBase::getSettingsForm

File

src/Plugin/BusinessRulesVariable/EntityFieldVariable.php, line 39

Class

EntityFieldVariable
Class EntityValue.

Namespace

Drupal\business_rules\Plugin\BusinessRulesVariable

Code

public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item) {
  $settings['data'] = [
    '#type' => 'select',
    '#title' => t('Data'),
    '#required' => TRUE,
    '#options' => [
      '' => t('- Select -'),
      self::CURRENT_DATA => t('Current value'),
      self::ORIGINAL_DATA => t('Original value'),
    ],
    '#description' => t('Current value is the value that is being saved.') . '<br>' . t('Original value is the previous saved value.'),
    '#default_value' => empty($item
      ->getSettings('data')) ? '' : $item
      ->getSettings('data'),
  ];
  return $settings;
}