Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Data
Form
Element
Time.php
Go to the documentation of this file.
1
<?php
12
namespace
Magento\Framework\Data\Form\Element
;
13
14
use
Magento\Framework\Escaper
;
15
16
class
Time
extends
AbstractElement
17
{
24
public
function
__construct
(
25
Factory
$factoryElement,
26
CollectionFactory
$factoryCollection,
27
Escaper
$escaper,
28
$data
= []
29
) {
30
parent::__construct($factoryElement, $factoryCollection, $escaper,
$data
);
31
$this->
setType
(
'time'
);
32
}
33
37
public
function
getName
()
38
{
39
$name
= parent::getName();
40
if
(strpos(
$name
,
'[]'
) ===
false
) {
41
$name
.=
'[]'
;
42
}
43
return
$name
;
44
}
45
51
public
function
getElementHtml
()
52
{
53
$this->
addClass
(
'select admin__control-select'
);
54
55
$valueHrs = 0;
56
$valueMin = 0;
57
$valueSec = 0;
58
59
if
(
$value
= $this->getValue()) {
60
$values
= explode(
','
,
$value
);
61
if
(is_array(
$values
) && count(
$values
) == 3) {
62
$valueHrs =
$values
[0];
63
$valueMin =
$values
[1];
64
$valueSec =
$values
[2];
65
}
66
}
67
68
$html =
'<input type="hidden" id="'
. $this->
getHtmlId
() .
'" '
. $this->
_getUiId
() .
'/>'
;
69
$html .=
'<select name="'
. $this->
getName
() .
'" style="width:80px" '
70
. $this->
serialize
($this->
getHtmlAttributes
())
71
. $this->
_getUiId
(
'hour'
) .
'>'
.
"\n"
;
72
for
(
$i
= 0;
$i
< 24;
$i
++) {
73
$hour = str_pad(
$i
, 2,
'0'
, STR_PAD_LEFT);
74
$html .=
'<option value="'
. $hour .
'" '
. ($valueHrs ==
75
$i
?
'selected="selected"'
:
''
) .
'>'
. $hour .
'</option>'
;
76
}
77
$html .=
'</select>'
.
"\n"
;
78
79
$html .=
': <select name="'
. $this->
getName
() .
'" style="width:80px" '
80
. $this->
serialize
($this->
getHtmlAttributes
())
81
. $this->
_getUiId
(
'minute'
) .
'>'
.
"\n"
;
82
for
(
$i
= 0;
$i
< 60;
$i
++) {
83
$hour = str_pad(
$i
, 2,
'0'
, STR_PAD_LEFT);
84
$html .=
'<option value="'
. $hour .
'" '
. ($valueMin ==
85
$i
?
'selected="selected"'
:
''
) .
'>'
. $hour .
'</option>'
;
86
}
87
$html .=
'</select>'
.
"\n"
;
88
89
$html .=
': <select name="'
. $this->
getName
() .
'" style="width:80px" '
90
. $this->
serialize
($this->
getHtmlAttributes
())
91
. $this->
_getUiId
(
'second'
) .
'>'
.
"\n"
;
92
for
(
$i
= 0;
$i
< 60;
$i
++) {
93
$hour = str_pad(
$i
, 2,
'0'
, STR_PAD_LEFT);
94
$html .=
'<option value="'
. $hour .
'" '
. ($valueSec ==
95
$i
?
'selected="selected"'
:
''
) .
'>'
. $hour .
'</option>'
;
96
}
97
$html .=
'</select>'
.
"\n"
;
98
$html .= $this->
getAfterElementHtml
();
99
return
$html;
100
}
101
}
Magento\Framework\Data\Form\Element\CollectionFactory
Definition:
CollectionFactory.php:10
Magento\Framework\Data\Form\Element\Time\__construct
__construct(Factory $factoryElement, CollectionFactory $factoryCollection, Escaper $escaper, $data=[])
Definition:
Time.php:24
Magento\Framework\Data\Form\Element\AbstractElement\getHtmlAttributes
getHtmlAttributes()
Definition:
AbstractElement.php:231
Magento\Framework\Data\Form\Element\AbstractElement\_getUiId
_getUiId($suffix=null)
Definition:
AbstractElement.php:333
Magento\Framework\Data\Form\Element\Factory
Definition:
Factory.php:14
Magento\Framework\Data\Form\Element\Time
Definition:
Time.php:16
$values
$values
Definition:
options.phtml:88
Magento\Framework\Escaper
Definition:
Escaper.php:15
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$value
$value
Definition:
gender.phtml:16
Magento\Framework\Data\Form\Element\Time\getElementHtml
getElementHtml()
Definition:
Time.php:51
Magento\Framework\Data\Form\Element\AbstractElement\addClass
addClass($class)
Definition:
AbstractElement.php:257
Magento\Framework\Data\Form\Element\AbstractElement\getHtmlId
getHtmlId()
Definition:
AbstractElement.php:172
Magento\Framework\Data\Form\Element\AbstractElement\setType
setType($type)
Definition:
AbstractElement.php:197
Magento\Framework\Data\Form\Element\AbstractElement\serialize
serialize($attributes=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
Definition:
AbstractElement.php:486
Magento\Framework\Data\Form\Element
Definition:
AbstractElement.php:6
Magento\Framework\Data\Form\Element\AbstractElement\getAfterElementHtml
getAfterElementHtml()
Definition:
AbstractElement.php:393
$i
$i
Definition:
gallery.phtml:31
Magento\Framework\Data\Form\Element\Time\getName
getName()
Definition:
Time.php:37
Magento\Framework\Data\Form\Element\AbstractElement
Definition:
AbstractElement.php:21
$name
if(!isset($_GET['name'])) $name
Definition:
log.php:14