本文整理汇总了PHP中Magento\Framework\Data\Form\Element\AbstractElement::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractElement::getValue方法的具体用法?PHP AbstractElement::getValue怎么用?PHP AbstractElement::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Data\Form\Element\AbstractElement
的用法示例。
在下文中一共展示了AbstractElement::getValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getElementHtml
/**
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$element->setStyle('width:70px;')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = [];
}
$from = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$to = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
return __('<label class="label"><span>from</span></label>') . $from . __('<label class="label"><span>to</span></label>') . $to;
}
示例2: _getElementHtml
/**
* @param AbstractElement $element
* @return string
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _getElementHtml(AbstractElement $element)
{
$_options = ['d' => __('Day'), 'm' => __('Month'), 'y' => __('Year')];
$element->setValues($_options)->setClass('select-date')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = [];
}
$_parts = [];
$_parts[] = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$_parts[] = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
$_parts[] = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
return implode(' <span>/</span> ', $_parts);
}
示例3: _getElementHtml
/**
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$extensionVersion = $this->_helper->getExtensionVersion();
$versionLabel = sprintf('<a href="%s" title="Easy Template Path Hints for Magento 2" target="_blank">%s</a>', self::EXTENSION_URL, $extensionVersion);
$element->setValue($versionLabel);
return $element->getValue();
}
示例4: _getElementHtml
/**
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$extensionVersion = $this->_helper->getExtensionVersion();
$extensionTitle = 'Custom Shipping';
$versionLabel = sprintf('<a href="%s" title="%s" target="_blank">%s</a>', self::EXTENSION_URL, $extensionTitle, $extensionVersion);
$element->setValue($versionLabel);
return $element->getValue();
}
示例5: _getElementHtml
/**
* @param AbstractElement $element
* @return string
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _getElementHtml(AbstractElement $element)
{
$_months = [];
for ($i = 1; $i <= 12; $i++) {
$_months[$i] = $this->_localeDate->date(mktime(null, null, null, $i))->format('m');
}
$_days = [];
for ($i = 1; $i <= 31; $i++) {
$_days[$i] = $i < 10 ? '0' . $i : $i;
}
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = [];
}
$element->setName($element->getName() . '[]');
$_monthsHtml = $element->setStyle('width:100px;')->setValues($_months)->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$_daysHtml = $element->setStyle('width:50px;')->setValues($_days)->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
return sprintf('%s %s', $_monthsHtml, $_daysHtml);
}
示例6: getInputHtml
/**
* Render HTML of the element using the rule engine.
*
* @return string
*/
public function getInputHtml()
{
$this->rule->setElementName($this->element->getName());
if ($this->element->getValue()) {
/* Hack : reload in a new instance to have element name set.
* can not be done in afterLoad of the backend model
* since we do not know yet the form structure
*/
$conditions = $this->element->getValue()->getConditions()->asArray();
$this->rule->getConditions()->loadArray($conditions);
$this->element->setRule($this->rule);
}
$this->input = $this->elementFactory->create('text');
$this->input->setRule($this->rule)->setRenderer($this->conditions);
return $this->input->toHtml();
}
示例7: render
/**
* Render element
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*
* @see RendererInterface::render()
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$element->addClass('element-value-changer');
$valueName = $element->getValueName();
if ($valueName === '') {
$valueName = '...';
}
if ($element->getShowAsText()) {
$html = ' <input type="hidden" class="hidden" id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $element->getValue() . '"/> ' . htmlspecialchars($valueName) . ' ';
} else {
$html = ' <span class="rule-param"' . ($element->getParamId() ? ' id="' . $element->getParamId() . '"' : '') . '>' . '<a href="javascript:void(0)" class="label">';
if ($this->inlineTranslate->isAllowed()) {
$html .= $this->escapeHtml($valueName);
} else {
$html .= $this->escapeHtml($this->filterManager->truncate($valueName, ['length' => 33, 'etc' => '...']));
}
$html .= '</a><span class="element"> ' . $element->getElementHtml();
if ($element->getExplicitApply()) {
$html .= ' <a href="javascript:void(0)" class="rule-param-apply"><img src="' . $this->getViewFileUrl('images/rule_component_apply.gif') . '" class="v-middle" alt="' . __('Apply') . '" title="' . __('Apply') . '" /></a> ';
}
$html .= '</span></span> ';
}
return $html;
}
示例8: _getElementHtml
/**
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$element->setValue($this->_cache->load('admin_notifications_lastcheck'));
$format = $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM);
return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $format);
}
示例9: _getElementHtml
/**
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$element->setValue($this->_cache->load('admin_notifications_lastcheck'));
$format = $this->_localeDate->getDateTimeFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM);
return $this->_localeDate->date(intval($element->getValue()))->toString($format);
}
示例10: _getElementHtml
/**
* @param AbstractElement $element
* @return string
* @codeCoverageIgnore
*/
protected function _getElementHtml(AbstractElement $element)
{
return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM));
}
示例11: _getElementHtml
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$element->setValue($this->_cache->load(\Dotdigitalgroup\Email\Helper\Config::CONNECTOR_FEED_LAST_CHECK_TIME));
$format = $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM);
return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $format);
}