Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplytest
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
simplytest
Merge requests
!32
Message block module added with a region for it.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Message block module added with a region for it.
issue/simplytest-3199429:messages
into
8.x-4.x
Overview
1
Commits
3
Pipelines
0
Changes
11
Merged
Abhisek Mazumdar
requested to merge
issue/simplytest-3199429:messages
into
8.x-4.x
4 years ago
Overview
1
Commits
3
Pipelines
0
Changes
11
Expand
0
0
Merge request reports
Compare
8.x-4.x
version 3
e08ccce4
4 years ago
version 2
46fd0dc1
4 years ago
version 1
bc0bb70a
4 years ago
8.x-4.x (base)
and
latest version
latest version
f9e51d07
3 commits,
4 years ago
version 3
e08ccce4
2 commits,
4 years ago
version 2
46fd0dc1
1 commit,
4 years ago
version 1
bc0bb70a
1 commit,
4 years ago
11 files
+
331
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
11
Search (e.g. *.vue) (Ctrl+P)
modules/simplytest_messages/src/Form/SettingsForm.php
0 → 100644
+
77
−
0
Options
<?php
namespace
Drupal\simplytest_messages\Form
;
use
Drupal\Core\Form\ConfigFormBase
;
use
Drupal\Core\Form\FormStateInterface
;
/**
* Configure Simplytest Messages settings for this site.
*/
class
SettingsForm
extends
ConfigFormBase
{
/**
* {@inheritdoc}
*/
public
function
getFormId
()
{
return
'simplytest_messages_settings'
;
}
/**
* {@inheritdoc}
*/
protected
function
getEditableConfigNames
()
{
return
[
'simplytest_messages.settings'
];
}
/**
* {@inheritdoc}
*/
public
function
buildForm
(
array
$form
,
FormStateInterface
$form_state
)
{
$messageConfig
=
$this
->
config
(
'simplytest_messages.settings'
);
$form
[
'enable'
]
=
[
'#type'
=>
'checkbox'
,
'#title'
=>
$this
->
t
(
'Enable the Message Block'
),
'#description'
=>
$this
->
t
(
'If this checkbox is checked the message block will be visible on the front page.'
),
'#default_value'
=>
$messageConfig
->
get
(
'enable'
),
];
$form
[
'message'
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
$this
->
t
(
'Message'
),
];
$form
[
'message'
][
'title'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'Title'
),
'#default_value'
=>
$messageConfig
->
get
(
'title'
),
];
$form
[
'message'
][
'icon'
]
=
[
'#type'
=>
'managed_file'
,
'#title'
=>
$this
->
t
(
'Icon'
),
'#upload_location'
=>
'public://'
,
'#default_value'
=>
$messageConfig
->
get
(
'icon'
),
];
$form
[
'message'
][
'body'
]
=
[
'#type'
=>
'text_format'
,
'#title'
=>
$this
->
t
(
'Body'
),
'#default_value'
=>
$messageConfig
->
get
(
'body'
)[
'value'
],
];
return
parent
::
buildForm
(
$form
,
$form_state
);
}
/**
* {@inheritdoc}
*/
public
function
submitForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
$this
->
config
(
'simplytest_messages.settings'
)
->
set
(
'enable'
,
$form_state
->
getValue
(
'enable'
))
->
set
(
'title'
,
$form_state
->
getValue
(
'title'
))
->
set
(
'icon'
,
$form_state
->
getValue
(
'icon'
))
->
set
(
'body'
,
$form_state
->
getValue
(
'body'
))
->
save
();
parent
::
submitForm
(
$form
,
$form_state
);
}
}
Loading