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
df9acbc3
Commit
df9acbc3
authored
5 years ago
by
Marcin Kolanko
Browse files
Options
Downloads
Patches
Plain Diff
added button form field
parent
035e03e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Field/ButtonField.php
+15
-0
15 additions, 0 deletions
src/Field/ButtonField.php
templates/button.php
+63
-0
63 additions, 0 deletions
templates/button.php
with
78 additions
and
0 deletions
src/Field/ButtonField.php
0 → 100644
+
15
−
0
View file @
df9acbc3
<?php
namespace
DropshippingXmlVendor\WPDesk\Forms\Field
;
class
ButtonField
extends
\DropshippingXmlVendor\WPDesk\Forms\Field\NoValueField
{
public
function
get_template_name
()
{
return
'button'
;
}
public
function
get_type
()
{
return
'button'
;
}
}
This diff is collapsed.
Click to expand it.
templates/button.php
0 → 100644
+
63
−
0
View file @
df9acbc3
<?php
/**
* @var \WPDesk\Forms\Field $field
* @var \WPDesk\View\Renderer\Renderer $renderer
* @var string $name_prefix
* @var string $value
*
* @var string $template_name Real field template.
*
*/
?>
<button
<?php
if
(
$field
->
has_classes
())
{
?>
class=
"
<?php
echo
\esc_attr
(
$field
->
get_classes
());
?>
"
<?php
}
?>
<?php
foreach
(
$field
->
get_attributes
([])
as
$key
=>
$val
)
{
?>
<?php
echo
$key
;
?>
="
<?php
echo
\esc_attr
(
$val
);
?>
"
<?php
}
?>
type=
"
<?php
echo
\esc_attr
(
$field
->
get_type
());
?>
"
name=
"
<?php
echo
\esc_attr
(
$name_prefix
);
?>
[
<?php
echo
\esc_attr
(
$field
->
get_name
());
?>
]"
id=
"
<?php
echo
\esc_attr
(
$field
->
get_id
());
?>
"
value=
"
<?php
echo
\esc_html
(
$value
);
?>
"
<?php
if
(
$field
->
is_required
())
{
?>
required=
"required"
<?php
}
?>
<?php
if
(
$field
->
is_disabled
())
{
?>
disabled=
"disabled"
<?php
}
?>
<?php
if
(
$field
->
is_readonly
())
{
?>
readonly=
"readonly"
<?php
}
?>
>
<?php
echo
\esc_html
(
$field
->
get_label
());
?>
</button>
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