Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fapi_validation
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
fapi_validation
Merge requests
!76
Issue
#3500182
- Add new examples
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3500182
- Add new examples
issue/fapi_validation-3500182:3500182-add-new-examples
into
3.0.x
Overview
0
Commits
2
Pipelines
2
Changes
1
Merged
Viktor Holovachek
requested to merge
issue/fapi_validation-3500182:3500182-add-new-examples
into
3.0.x
3 months ago
Overview
0
Commits
2
Pipelines
2
Changes
1
Expand
Related to
#3500182
0
0
Merge request reports
Compare
3.0.x
version 1
47169713
3 months ago
3.0.x (base)
and
latest version
latest version
8ff1cf9e
2 commits,
3 months ago
version 1
47169713
1 commit,
3 months ago
1 file
+
32
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
fapiv_example/src/Form/SimpleForm.php
+
32
−
0
Options
@@ -46,6 +46,38 @@ class SimpleForm extends FormBase {
@@ -46,6 +46,38 @@ class SimpleForm extends FormBase {
'#required'
=>
TRUE
,
'#required'
=>
TRUE
,
];
];
$form
[
'mail'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'Email'
),
'#description'
=>
$this
->
t
(
'Email must be valid e-mail address.'
),
'#validators'
=>
[
'email'
],
'#required'
=>
TRUE
,
];
$form
[
'range'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'Range'
),
'#description'
=>
$this
->
t
(
'The value should be between 0 and 100.'
),
'#validators'
=>
[
'rule'
=>
'range[0, 100]'
],
'#required'
=>
TRUE
,
];
$form
[
'ip'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'IP address'
),
'#description'
=>
$this
->
t
(
'The value should be valid IP address. e.g. 127.0.0.1'
),
'#validators'
=>
[
'ipv4'
],
'#required'
=>
TRUE
,
];
$form
[
'url'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'URL'
),
'#description'
=>
$this
->
t
(
'The value should be valid absolute URL. e.g. http://example.com'
),
'#validators'
=>
[
'url[absolute]'
],
'#required'
=>
TRUE
,
];
// Group submit handlers in an actions element with a key of "actions" so
// Group submit handlers in an actions element with a key of "actions" so
// that it gets styled correctly, and so that other modules may add actions
// that it gets styled correctly, and so that other modules may add actions
// to the form. This is not required, but is convention.
// to the form. This is not required, but is convention.
Loading