You are here

public function SaveEntityVariableAction::getSettingsForm in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesAction/SaveEntityVariableAction.php \Drupal\business_rules\Plugin\BusinessRulesAction\SaveEntityVariableAction::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/BusinessRulesAction/SaveEntityVariableAction.php, line 45

Class

SaveEntityVariableAction
Class SaveEntityVariableAction.

Namespace

Drupal\business_rules\Plugin\BusinessRulesAction

Code

public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item) {
  $settings = [];
  if (!$item
    ->isNew()) {
    $settings['variable'] = [
      '#type' => 'select',
      '#title' => t('Entity variable'),
      '#required' => TRUE,
      '#description' => t('Entity variable to be saved. Remember to create actions to fill the entity variable fields and execute them before save the entity.'),
      '#options' => $this
        ->getAvailableEmptyVariables($item),
      '#default_value' => empty($item
        ->getSettings('variable')) ? '' : $item
        ->getSettings('variable'),
    ];
  }
  return $settings;
}