You are here

protected static function RestUIForm::getConfigurationForResourceGranularity in REST UI 8

Calculates the REST resource configuration when granularity is 'resource'.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The value for the 'configuration' key in a REST Resource config entity.

1 call to RestUIForm::getConfigurationForResourceGranularity()
RestUIForm::submitForm in src/Form/RestUIForm.php
Form submission handler.

File

src/Form/RestUIForm.php, line 476

Class

RestUIForm
Provides a REST resource configuration form.

Namespace

Drupal\restui\Form

Code

protected static function getConfigurationForResourceGranularity(FormStateInterface $form_state) {
  $settings = $form_state
    ->getValue([
    'wrapper',
    'settings',
  ]);
  $configuration = [
    'methods' => array_keys(array_filter($settings['methods'])),
    'formats' => array_keys(array_filter($settings['formats'])),
    'authentication' => array_keys(array_filter($settings['authentication'])),
  ];
  return $configuration;
}