Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-forms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-forms
Commits
b646e8b2
Unverified
Commit
b646e8b2
authored
3 years ago
by
Bartek Jaskulski
Browse files
Options
Downloads
Patches
Plain Diff
feat: add email input field
parent
35715e1a
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!28
release: 3.0.0
,
!19
Add strong typing for 3.0 version
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Field/InputEmailField.php
+22
-0
22 additions, 0 deletions
src/Field/InputEmailField.php
src/Sanitizer/EmailSanitizer.php
+12
-0
12 additions, 0 deletions
src/Sanitizer/EmailSanitizer.php
with
34 additions
and
0 deletions
src/Field/InputEmailField.php
0 → 100644
+
22
−
0
View file @
b646e8b2
<?php
namespace
WPDesk\Forms\Field
;
use
WPDesk\Forms\Sanitizer
;
use
WPDesk\Forms\Sanitizer\EmailSanitizer
;
class
InputEmailField
extends
BasicField
{
public
function
__construct
()
{
parent
::
__construct
();
$this
->
set_default_value
(
''
);
$this
->
set_attribute
(
'type'
,
'email'
);
}
public
function
get_sanitizer
():
Sanitizer
{
return
new
EmailSanitizer
();
}
public
function
get_template_name
():
string
{
return
'input-text'
;
}
}
This diff is collapsed.
Click to expand it.
src/Sanitizer/EmailSanitizer.php
0 → 100644
+
12
−
0
View file @
b646e8b2
<?php
namespace
WPDesk\Forms\Sanitizer
;
use
WPDesk\Forms\Sanitizer
;
class
EmailSanitizer
implements
Sanitizer
{
public
function
sanitize
(
$value
):
string
{
return
sanitize_email
(
$value
);
}
}
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