You are here

public function ShowMessage::getSettingsForm in Business Rules 2.x

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

Class

ShowMessage
Class ShowMessage.

Namespace

Drupal\business_rules\Plugin\BusinessRulesAction

Code

public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item) {
  $settings['message_type'] = [
    '#type' => 'select',
    '#title' => t('Message Type'),
    '#required' => TRUE,
    '#default_value' => $item
      ->getSettings('message_type'),
    '#options' => [
      'status' => t('Status message'),
      'warning' => t('Warning message'),
      'error' => t('Error message'),
    ],
  ];
  $settings['message'] = [
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#description' => t('To use variables on the message, just type the variable machine name as {{variable_id}}.'),
    '#required' => TRUE,
    '#default_value' => $item
      ->getSettings('message'),
  ];
  return $settings;
}