Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsonapi_image_styles
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
jsonapi_image_styles
Commits
eaeed135
Commit
eaeed135
authored
5 years ago
by
Timo Kirkkala
Browse files
Options
Downloads
Patches
Plain Diff
Coding standards fix
parent
bd372741
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Form/JsonApiImageStylesAdminForm.php
+16
-6
16 additions, 6 deletions
src/Form/JsonApiImageStylesAdminForm.php
with
16 additions
and
6 deletions
src/Form/JsonApiImageStylesAdminForm.php
+
16
−
6
View file @
eaeed135
<?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
();
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment