protected static function RestUIForm::getConfigurationForMethodGranularity in REST UI 8
Calculates the REST resource configuration when granularity is 'method'.
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::getConfigurationForMethodGranularity()
- RestUIForm::submitForm in src/
Form/ RestUIForm.php - Form submission handler.
File
- src/
Form/ RestUIForm.php, line 450
Class
- RestUIForm
- Provides a REST resource configuration form.
Namespace
Drupal\restui\FormCode
protected static function getConfigurationForMethodGranularity(FormStateInterface $form_state) {
$configuration = [];
$methods = $form_state
->getValue([
'wrapper',
'methods',
]);
foreach ($methods as $method => $settings) {
if ($settings[$method]) {
$configuration[$method] = [
'supported_formats' => array_keys(array_filter($settings['settings']['formats'])),
'supported_auth' => array_keys(array_filter($settings['settings']['auth'])),
];
}
else {
unset($configuration[$method]);
}
}
return $configuration;
}