当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractElement::getExtType方法代码示例

本文整理汇总了PHP中Magento\Framework\Data\Form\Element\AbstractElement::getExtType方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractElement::getExtType方法的具体用法?PHP AbstractElement::getExtType怎么用?PHP AbstractElement::getExtType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Data\Form\Element\AbstractElement的用法示例。


在下文中一共展示了AbstractElement::getExtType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getAdditionalElementHtml

    /**
     * Custom additional element html
     *
     * @param AbstractElement $element
     * @return string
     */
    protected function _getAdditionalElementHtml($element)
    {
        // Add name attribute to checkboxes that correspond to multiselect elements
        $nameAttributeHtml = $element->getExtType() === 'multiple' ? 'name="' . $element->getId() . '_checkbox"' : '';
        $elementId = $element->getId();
        $checkboxLabel = __('Change');
        $html = <<<HTML
<span class="attribute-change-checkbox">
    <label>
        <input type="checkbox" {$nameAttributeHtml} onclick="toogleFieldEditMode(this, '{$elementId}')" />
        {$checkboxLabel}
    </label>
</span>
<script>initDisableFields("{$elementId}")</script>
HTML;
        if ($elementId === 'weight') {
            $html .= <<<HTML
<script>jQuery(function(\$) {
    \$('#weight_and_type_switcher, label[for=weight_and_type_switcher]').hide();
});</script>
HTML;
        }
        return $html;
    }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:30,代码来源:Attributes.php

示例2: _getAdditionalElementHtml

    /**
     * Custom additional element html
     *
     * @param AbstractElement $element
     * @return string
     */
    protected function _getAdditionalElementHtml($element)
    {
        // Add name attribute to checkboxes that correspond to multiselect elements
        $nameAttributeHtml = $element->getExtType() === 'multiple' ? 'name="' . $element->getId() . '_checkbox"' : '';
        $elementId = $element->getId();
        $dataAttribute = "data-disable='{$elementId}'";
        $dataCheckboxName = "toggle_" . "{$elementId}";
        $checkboxLabel = __('Change');
        $html = <<<HTML
<span class="attribute-change-checkbox">
    <input type="checkbox" id="{$dataCheckboxName}" name="{$dataCheckboxName}" class="checkbox" {$nameAttributeHtml} onclick="toogleFieldEditMode(this, '{$elementId}')" {$dataAttribute} />
    <label class="label" for="{$dataCheckboxName}">
        {$checkboxLabel}
    </label>
</span>
HTML;
        if ($elementId === 'weight') {
            $html .= <<<HTML
<script type="text/javascript">require(["jquery"],function(\$) {
    \$('#weight_and_type_switcher, label[for=weight_and_type_switcher]').hide();
});</script>
HTML;
        }
        return $html;
    }
开发者ID:aiesh,项目名称:magento2,代码行数:31,代码来源:Attributes.php

示例3: _getAdditionalElementHtml

    /**
     * Custom additional element html
     *
     * @param AbstractElement $element
     * @return string
     */
    protected function _getAdditionalElementHtml($element)
    {
        // Add name attribute to checkboxes that correspond to multiselect elements
        $nameAttributeHtml = $element->getExtType() === 'multiple' ? 'name="' . $element->getId() . '_checkbox"' : '';
        $elementId = $element->getId();
        $dataAttribute = "data-disable='{$elementId}'";
        $dataCheckboxName = "toggle_" . "{$elementId}";
        $checkboxLabel = __('Change');
        $html = <<<HTML
<span class="attribute-change-checkbox">
    <input type="checkbox" id="{$dataCheckboxName}" name="{$dataCheckboxName}" class="checkbox" {$nameAttributeHtml} onclick="toogleFieldEditMode(this, '{$elementId}')" {$dataAttribute} />
    <label class="label" for="{$dataCheckboxName}">
        {$checkboxLabel}
    </label>
</span>
HTML;
        if ($elementId === 'weight') {
            $html .= <<<HTML
<script>require(['Magento_Catalog/js/product/weight-handler'], function (weightHandle) {
    weightHandle.hideWeightSwitcher();
});</script>
HTML;
        }
        return $html;
    }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:31,代码来源:Attributes.php

示例4: shouldLabelBeAtRight

 /**
  * 2015-11-24
  * @used-by \Df\Backend\Block\Widget\Form\Renderer\Fieldset\Element::shouldLabelBeAtRight()
  * @param AE|Element $e
  * @return bool
  */
 public static function shouldLabelBeAtRight(AE $e)
 {
     /** @var string|null $position */
     $position = $e->getLabelPosition();
     return $position ? ElementI::AFTER === $position : in_array($e->getExtType(), ['checkbox', 'radio']);
 }
开发者ID:mage2pro,项目名称:core,代码行数:12,代码来源:Element.php


注:本文中的Magento\Framework\Data\Form\Element\AbstractElement::getExtType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。