Skip to content
Snippets Groups Projects
Commit eaeed135 authored by Timo Kirkkala's avatar Timo Kirkkala
Browse files

Coding standards fix

parent bd372741
Branches
Tags 8.x-1.0-beta1
No related merge requests found
<?php <?php
/**
* @file
* Contains Drupal\jsonapi_image_styles\Form\JsonApiImageStylesAdminForm.
*/
namespace Drupal\jsonapi_image_styles\Form; namespace Drupal\jsonapi_image_styles\Form;
...@@ -10,20 +6,30 @@ ...@@ -10,20 +6,30 @@
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\image\Entity\ImageStyle; use Drupal\image\Entity\ImageStyle;
/**
* Class JsonApiImageStylesAdminForm.
*/
class JsonApiImageStylesAdminForm extends ConfigFormBase { class JsonApiImageStylesAdminForm extends ConfigFormBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getEditableConfigNames() { protected function getEditableConfigNames() {
return [ return [
'jsonapi_image_styles.settings' 'jsonapi_image_styles.settings',
]; ];
} }
/**
* {@inheritdoc}
*/
public function getFormId() { public function getFormId() {
return 'jsonapi_image_styles_admin_form'; return 'jsonapi_image_styles_admin_form';
} }
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) { public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('jsonapi_image_styles.settings'); $config = $this->config('jsonapi_image_styles.settings');
...@@ -36,7 +42,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -36,7 +42,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['image_styles'] = [ $form['image_styles'] = [
'#type' => 'checkboxes', '#type' => 'checkboxes',
'#title' => $this->t('Image styles'), '#title' => $this->t('Image styles'),
'#description' => $this->t('Select image styles to expose for JSON:API. If none are selected, all styles are exposed. '), '#description' => $this->t('Select image styles to expose for JSON:API. If none are selected, all styles are exposed.'),
'#options' => $options, '#options' => $options,
'#default_value' => (is_array($config->get('image_styles'))) ? $config->get('image_styles') : [], '#default_value' => (is_array($config->get('image_styles'))) ? $config->get('image_styles') : [],
]; ];
...@@ -44,6 +50,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -44,6 +50,9 @@ public function buildForm(array $form, FormStateInterface $form_state) {
return parent::buildForm($form, $form_state); return parent::buildForm($form, $form_state);
} }
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state); parent::submitForm($form, $form_state);
...@@ -51,4 +60,5 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -51,4 +60,5 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
->set('image_styles', $form_state->getValue('image_styles')) ->set('image_styles', $form_state->getValue('image_styles'))
->save(); ->save();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment