Skip to content
Snippets Groups Projects
Commit df9acbc3 authored by Marcin Kolanko's avatar Marcin Kolanko
Browse files

added button form field

parent 035e03e3
No related branches found
No related tags found
No related merge requests found
<?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';
}
}
<?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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment