本文整理汇总了PHP中Magento\Framework\Data\Form\Element\AbstractElement::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractElement::getData方法的具体用法?PHP AbstractElement::getData怎么用?PHP AbstractElement::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Data\Form\Element\AbstractElement
的用法示例。
在下文中一共展示了AbstractElement::getData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
if (!$element instanceof Select || empty($element->getData('values'))) {
return '';
}
return parent::render($element);
}
示例2: render
public function render(AbstractElement $element)
{
$isRequired = $element->getData('required');
if ($isRequired === true) {
$element->removeClass('required-entry');
$element->removeClass('_required');
$element->setClass('M2ePro-required-when-visible ' . $element->getClass());
}
$tooltip = $element->getData('tooltip');
if (is_null($tooltip)) {
$element->addClass('m2epro-field-without-tooltip');
return parent::render($element);
}
$element->setAfterElementHtml($element->getAfterElementHtml() . $this->getTooltipHtml($tooltip));
$element->addClass('m2epro-field-with-tooltip');
return parent::render($element);
}
示例3: render
/**
* Checkbox render function
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
/** @var \Magento\Framework\Data\Form\Element\Checkbox $checkbox */
$checkbox = $this->_elementFactory->create('checkbox', array('data' => $element->getData()));
$checkbox->setForm($element->getForm());
$elementHtml = sprintf('<div class="field no-label field-%s with-note">' . '<div class="control">' . '<div class="nested">' . '<div class="field choice"> %s' . '<label class="label" for="%s">%s</label>' . '<p class="note">%s</p>' . '</div>' . '</div>' . '</div>' . '</div>', $element->getHtmlId(), $checkbox->getElementHtml(), $element->getHtmlId(), $element->getLabel(), $element->getNote());
return $elementHtml;
}
示例4: render
public function render(AbstractElement $element)
{
$element->addClass('m2epro-fieldset');
$tooltip = $element->getData('tooltip');
if (is_null($tooltip)) {
return parent::render($element);
}
$element->addField('help_block_' . $element->getId(), \Ess\M2ePro\Block\Adminhtml\Magento\Form\AbstractForm::HELP_BLOCK, ['content' => $tooltip, 'tooltiped' => true], '^');
$directionClass = $element->getData('direction_class');
$element->setLegend($element->getLegend() . $this->getTooltipHtml($tooltip, empty($directionClass) ? 'right' : $directionClass));
return parent::render($element);
}
示例5: _getHeaderCommentHtml
/**
* 2016-07-01
* @override
* @see \Magento\Config\Block\System\Config\Form\Fieldset::_getHeaderCommentHtml()
* https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Config/Block/System/Config/Form/Fieldset.php#L166-L175
* @used-by \Magento\Config\Block\System\Config\Form\Fieldset::_getHeaderHtml()
* https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Config/Block/System/Config/Form/Fieldset.php#L121
* @param AE|F $element
* @return string
*/
protected function _getHeaderCommentHtml($element)
{
/** @var string|null $infoClass */
$infoClass = dfa_deep($element->getData(), 'group/dfExtension');
/** @var string $result */
if (!$infoClass) {
$result = parent::_getHeaderCommentHtml($element);
} else {
/** @var \Df\Config\Ext $extensionInfo */
$info = df_o($infoClass);
$result = df_tag('div', 'comment', df_tag_ab(__('Have a question?'), $info->url()));
}
return $result;
}
示例6: _getElementHtml
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$html = $element->getElementHtml();
$value = $element->getData('value');
$html .= '<script type="text/javascript">
require(["jquery","jquery/colorpicker/js/colorpicker"], function ($) {
$(document).ready(function () {
var $el = $("#' . $element->getHtmlId() . '");
$el.css("backgroundColor", "' . $value . '");
// Attach the color picker
$el.ColorPicker({
color: "' . $value . '",
onChange: function (hsb, hex, rgb) {
$el.css("backgroundColor", "#" + hex).val("#" + hex);
}
});
});
});
</script>';
return $html;
}
示例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() . '" data-form-part="' . $element->getData('data-form-part') . '"/> ' . 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;
}