You are here

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

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

Class

ViewResultVariable
Class ViewResultVariable.

Namespace

Drupal\business_rules\Plugin\BusinessRulesVariable

Code

public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item) {
  $settings['view'] = [
    '#type' => 'select',
    '#title' => t('View to execute. View name : Display mode id : Display mode title.'),
    '#options' => $this->util
      ->getViewsOptions(),
    '#required' => TRUE,
    '#default_value' => $item
      ->getSettings('view'),
    '#description' => t("Select the view to get the results. When you use the view fields, it will always have the raw value."),
  ];
  $settings['view_html'] = [
    '#title' => t('Use HTML rendered view fields'),
    '#type' => 'checkbox',
    '#default_value' => $item
      ->getSettings('view_html'),
    '#description' => t('If checked, changes on the view fields formatter will reflect into the variables and HTML markup will be used.'),
  ];
  $settings['arguments'] = [
    '#type' => 'textarea',
    '#title' => t('Arguments'),
    '#description' => t('Any argument the view may need, one per line. Be aware of including them at same order as the CONTEXTUAL FILTERS configured in the view. You may use variables.'),
    '#default_value' => $item
      ->getSettings('arguments'),
  ];
  $form['#attached']['library'][] = 'business_rules/style';
  return $settings;
}