You are here

public function RestExport::buildOptionsForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Plugin/views/display/RestExport.php \Drupal\rest\Plugin\views\display\RestExport::buildOptionsForm()
  2. 9 core/modules/rest/src/Plugin/views/display/RestExport.php \Drupal\rest\Plugin\views\display\RestExport::buildOptionsForm()

Provides the default form for setting options.

Overrides PathPluginBase::buildOptionsForm

File

core/modules/rest/src/Plugin/views/display/RestExport.php, line 312

Class

RestExport
The plugin that handles Data response callbacks for REST resources.

Namespace

Drupal\rest\Plugin\views\display

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  if ($form_state
    ->get('section') === 'auth') {
    $form['#title'] .= $this
      ->t('The supported authentication methods for this view');
    $form['auth'] = [
      '#type' => 'checkboxes',
      '#title' => $this
        ->t('Authentication methods'),
      '#description' => $this
        ->t('These are the supported authentication providers for this view. When this view is requested, the client will be forced to authenticate with one of the selected providers. Make sure you set the appropriate requirements at the <em>Access</em> section since the Authentication System will fallback to the anonymous user if it fails to authenticate. For example: require Access: Role | Authenticated User.'),
      '#options' => $this
        ->getAuthOptions(),
      '#default_value' => $this
        ->getOption('auth'),
    ];
  }
}