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
!34
Issue
#3502062
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3502062
issue/fapi_validation-3502062:3502062-form-api-validation
into
3.0.x
Overview
0
Commits
4
Pipelines
3
Changes
2
Merged
lysenko
requested to merge
issue/fapi_validation-3502062:3502062-form-api-validation
into
3.0.x
3 months ago
Overview
0
Commits
4
Pipelines
3
Changes
2
Expand
Added base implementation of the filter 'UcwordsFilter' for the function 'ucwords'
Added unit test the filter 'UcwordsFilter'
Related to
#3502062
0
0
Merge request reports
Compare
3.0.x
version 1
953fd1d5
3 months ago
3.0.x (base)
and
latest version
latest version
116365af
4 commits,
3 months ago
version 1
953fd1d5
3 commits,
3 months ago
2 files
+
50
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/Plugin/FapiValidationFilter/UcwordsFilter.php
0 → 100644
+
26
−
0
Options
<?php
namespace
Drupal\fapi_validation\Plugin\FapiValidationFilter
;
use
Drupal\Core\StringTranslation\TranslatableMarkup
;
use
Drupal\fapi_validation
\Attribute\FapiValidationFilter
;
use
Drupal\fapi_validation
\FapiValidationFiltersInterface
;
/**
* Fapi Validation Plugin for 'ucwords' filter.
*/
#
[
FapiValidationFilter
(
id
:
'ucwords'
,
label
:
new
TranslatableMarkup
(
'Ucwords'
),
description
:
new
TranslatableMarkup
(
'Uppercase the first character of each word in a string.'
),
)]
class
UcwordsFilter
implements
FapiValidationFiltersInterface
{
/**
* {@inheritdoc}
*/
public
function
filter
(
$value
)
{
return
function_exists
(
' mb_convert_case'
)
?
mb_convert_case
(
$value
,
MB_CASE_TITLE
)
:
ucwords
(
$value
);
}
}
Loading