src/Form/RestUIForm.php | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/src/Form/RestUIForm.php b/src/Form/RestUIForm.php index d175874..11efc9f 100644 --- a/src/Form/RestUIForm.php +++ b/src/Form/RestUIForm.php @@ -56,25 +56,20 @@ class RestUIForm extends ConfigFormBase { /** * Constructs a \Drupal\user\RestForm object. * - * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory + * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. - * @param \Drupal\Core\Extension\ModuleHandler $module_handler + * @param \Drupal\Core\Extension\ModuleHandler $module_handler * The module handler. * @param \Drupal\Core\Authentication\AuthenticationCollectorInterface $authentication_collector * The authentication collector. - * @param array $formats + * @param array $formats * The available serialization formats. * @param \Drupal\rest\Plugin\Type\ResourcePluginManager $resourcePluginManager * The REST plugin manager. * @param \Drupal\Core\Entity\EntityStorageInterface $resource_config_storage * The REST resource config storage. */ - public function __construct( - ConfigFactoryInterface $config_factory, ModuleHandler $module_handler, - AuthenticationCollectorInterface $authentication_collector, array $formats, - ResourcePluginManager $resourcePluginManager, - EntityStorageInterface $resource_config_storage - ) { + public function __construct(ConfigFactoryInterface $config_factory, ModuleHandler $module_handler, AuthenticationCollectorInterface $authentication_collector, array $formats, ResourcePluginManager $resourcePluginManager, EntityStorageInterface $resource_config_storage) { parent::__construct($config_factory); $this->moduleHandler = $module_handler; $this->authenticationCollector = $authentication_collector; @@ -116,11 +111,11 @@ class RestUIForm extends ConfigFormBase { /** * {@inheritdoc} * - * @param array $form + * @param array $form * The form array. * @param \Drupal\Core\Form\FormStateInterface $form_state * The form state. - * @param string $resource_id + * @param string $resource_id * A string that identifies the REST resource. * * @return array @@ -129,9 +124,7 @@ class RestUIForm extends ConfigFormBase { * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * When no plugin found. */ - public function buildForm( - array $form, FormStateInterface $form_state, $resource_id = NULL - ) { + public function buildForm(array $form, FormStateInterface $form_state, $resource_id = NULL) { $plugin = $this->resourcePluginManager->createInstance($resource_id); if (empty($plugin)) { throw new NotFoundHttpException(); @@ -142,14 +135,9 @@ class RestUIForm extends ConfigFormBase { $config = $this->config("rest.resource.{$id}")->get('configuration') ?: []; $methods = $plugin->availableMethods(); $pluginDefinition = $plugin->getPluginDefinition(); - $form['#title'] = $this->t( - 'Settings for resource %label', ['%label' => $pluginDefinition['label']] - ); + $form['#title'] = $this->t('Settings for resource %label', ['%label' => $pluginDefinition['label']]); $form['#tree'] = TRUE; - $form['resource_id'] = array( - '#type' => 'value', - '#value' => $resource_id, - ); + $form['resource_id'] = array('#type' => 'value', '#value' => $resource_id); $method_options = array_combine($methods, $methods); $authentication_providers = array_keys( @@ -171,9 +159,7 @@ class RestUIForm extends ConfigFormBase { '#title' => t('Granularity'), '#type' => 'select', '#options' => array( - RestResourceConfigInterface::RESOURCE_GRANULARITY => $this->t( - 'Resource' - ), + RestResourceConfigInterface::RESOURCE_GRANULARITY => $this->t('Resource'), RestResourceConfigInterface::METHOD_GRANULARITY => $this->t('Method'), ), '#default_value' => $granularity, @@ -425,13 +411,12 @@ class RestUIForm extends ConfigFormBase { /** * Return the settings part of the form when rebuilding through ajax. * - * @param array $form + * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * * @return array */ - public function processAjaxForm(array $form, FormStateInterface &$form_state - ) { + public function processAjaxForm(array $form, FormStateInterface &$form_state) { return $form['wrapper']; }