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


PHP AbstractElement::getId方法代码示例

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


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

示例1: testIsCollapseState

 /**
  * @param mixed $expanded
  * @param int $expected
  * @dataProvider isCollapseStateDataProvider
  */
 public function testIsCollapseState($expanded, $expected)
 {
     $this->_user->setExtra(['configState' => []]);
     $this->_element->setGroup(isset($expanded) ? ['expanded' => $expanded] : []);
     $html = $this->_model->render($this->_element);
     $this->assertContains('<input id="' . $this->_element->getHtmlId() . '-state" name="config_state[' . $this->_element->getId() . ']" type="hidden" value="' . $expected . '" />', $html);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:GroupTest.php

示例2: _isCollapseState

 /**
  * Return collapse state
  *
  * @param AbstractElement $element
  * @return string|true
  */
 protected function _isCollapseState($element)
 {
     $extra = $this->_authSession->getUser()->getExtra();
     if (isset($extra['configState'][$element->getId()])) {
         return $extra['configState'][$element->getId()];
     }
     return true;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:Expanded.php

示例3: _isCollapseState

 /**
  * Return collapse state
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return bool
  */
 protected function _isCollapseState($element)
 {
     $extra = $this->_authSession->getUser()->getExtra();
     if (isset($extra['configState'][$element->getId()])) {
         return $extra['configState'][$element->getId()];
     }
     $groupConfig = $element->getGroup();
     if (!empty($groupConfig['expanded'])) {
         return true;
     }
     return false;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:Group.php

示例4: addElement

 /**
  * Add form element
  *
  * @param AbstractElement $element
  * @param bool $after
  * @return Form
  */
 public function addElement(AbstractElement $element, $after = false)
 {
     if ($this->getForm()) {
         $this->getForm()->checkElementId($element->getId());
         $this->getForm()->addElementToCollection($element);
     }
     parent::addElement($element, $after);
     return $this;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:16,代码来源:AbstractElement.php

示例5: prepareElementHtml

 /**
  * Prepare chooser element HTML
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element Form Element
  * @return \Magento\Framework\Data\Form\Element\AbstractElement
  */
 public function prepareElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $uniqId = $this->mathRandom->getUniqueHash($element->getId());
     $sourceUrl = $this->getUrl('cms/page_widget/chooser', ['uniq_id' => $uniqId]);
     $chooser = $this->getLayout()->createBlock('Magento\\Widget\\Block\\Adminhtml\\Widget\\Chooser')->setElement($element)->setConfig($this->getConfig())->setFieldsetId($this->getFieldsetId())->setSourceUrl($sourceUrl)->setUniqId($uniqId);
     if ($element->getValue()) {
         $page = $this->_pageFactory->create()->load((int) $element->getValue());
         if ($page->getId()) {
             $chooser->setLabel($this->escapeHtml($page->getTitle()));
         }
     }
     $element->setData('after_element_html', $chooser->toHtml());
     return $element;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:20,代码来源:Chooser.php

示例6: prepareElementHtml

 /**
  * Prepare chooser element HTML
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element Form Element
  * @return \Magento\Framework\Data\Form\Element\AbstractElement
  */
 public function prepareElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $uniqId = $this->mathRandom->getUniqueHash($element->getId());
     $sourceUrl = $this->getUrl('sales_rule/promo_quote/chooser', array('uniq_id' => $uniqId));
     $chooser = $this->getLayout()->createBlock('Magento\\Widget\\Block\\Adminhtml\\Widget\\Chooser')->setElement($element)->setConfig($this->getConfig())->setFieldsetId($this->getFieldsetId())->setSourceUrl($sourceUrl)->setUniqId($uniqId);
     if ($element->getValue()) {
         $rule = $this->ruleFactory->create()->load((int) $element->getValue());
         if ($rule->getId()) {
             $chooser->setLabel($rule->getName());
         }
     }
     $element->setData('after_element_html', $chooser->toHtml());
     return $element;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:Chooser.php

示例7: prepareElementHtml

 /**
  * Prepare chooser element HTML
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element Form Element
  * @return \Magento\Framework\Data\Form\Element\AbstractElement
  */
 public function prepareElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $uniqId = $this->mathRandom->getUniqueHash($element->getId());
     $sourceUrl = $this->getUrl('catalog/category_widget/chooser', ['uniq_id' => $uniqId, 'use_massaction' => false]);
     $chooser = $this->getLayout()->createBlock('Magento\\Widget\\Block\\Adminhtml\\Widget\\Chooser')->setElement($element)->setConfig($this->getConfig())->setFieldsetId($this->getFieldsetId())->setSourceUrl($sourceUrl)->setUniqId($uniqId);
     if ($element->getValue()) {
         $value = explode('/', $element->getValue());
         $categoryId = false;
         if (isset($value[0]) && isset($value[1]) && $value[0] == 'category') {
             $categoryId = $value[1];
         }
         if ($categoryId) {
             $label = $this->_categoryFactory->create()->load($categoryId)->getName();
             $chooser->setLabel($label);
         }
     }
     $element->setData('after_element_html', $chooser->toHtml());
     return $element;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:25,代码来源:Chooser.php

示例8: prepareElementHtml

 /**
  * Prepare chooser element HTML
  *
  * @param AbstractElement $element Form Element
  * @return AbstractElement
  */
 public function prepareElementHtml(AbstractElement $element)
 {
     $uniqId = $this->mathRandom->getUniqueHash($element->getId());
     $sourceUrl = $this->getUrl('catalog/product_widget/chooser', ['uniq_id' => $uniqId, 'use_massaction' => false]);
     $chooser = $this->getLayout()->createBlock('Magento\\Widget\\Block\\Adminhtml\\Widget\\Chooser')->setElement($element)->setConfig($this->getConfig())->setFieldsetId($this->getFieldsetId())->setSourceUrl($sourceUrl)->setUniqId($uniqId);
     if ($element->getValue()) {
         $value = explode('/', $element->getValue());
         $productId = false;
         if (isset($value[0]) && isset($value[1]) && $value[0] == 'product') {
             $productId = $value[1];
         }
         $categoryId = isset($value[2]) ? $value[2] : false;
         $label = '';
         if ($categoryId) {
             $label = $this->_resourceCategory->getAttributeRawValue($categoryId, 'name', $this->_storeManager->getStore()) . '/';
         }
         if ($productId) {
             $label .= $this->_resourceProduct->getAttributeRawValue($productId, 'name', $this->_storeManager->getStore());
         }
         $chooser->setLabel($label);
     }
     $element->setData('after_element_html', $chooser->toHtml());
     return $element;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:30,代码来源:Chooser.php

示例9: _addAdditionalFormElementData

 /**
  * Add additional data to form element
  *
  * @param AbstractElement $element
  * @return $this
  */
 protected function _addAdditionalFormElementData(AbstractElement $element)
 {
     switch ($element->getId()) {
         case 'email':
             $element->setRequired(0);
             $element->setClass('validate-email');
             break;
     }
     return $this;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:16,代码来源:Account.php

示例10: addElementToCollection

 /**
  * @param AbstractElement $element
  * @return $this
  */
 public function addElementToCollection($element)
 {
     $this->_elementsIndex[$element->getId()] = $element;
     $this->_allElements->add($element);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:Form.php

示例11: _addAdditionalFormElementData

 /**
  * Add additional data to form element
  *
  * @param AbstractElement $element
  * @return $this
  */
 protected function _addAdditionalFormElementData(AbstractElement $element)
 {
     if ($element->getId() == 'region_id') {
         $element->setNoDisplay(true);
     }
     return $this;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:13,代码来源:Address.php

示例12: _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

示例13: _isCollapseState

 /**
  * Collapsed or expanded fieldset when page loaded?
  *
  * @param AbstractElement $element
  * @return bool
  */
 protected function _isCollapseState($element)
 {
     if ($element->getExpanded() || $element->getForm() && $element->getForm()->getElements()->count() === 1) {
         return true;
     }
     $extra = $this->_authSession->getUser()->getExtra();
     if (isset($extra['configState'][$element->getId()])) {
         return $extra['configState'][$element->getId()];
     }
     return $this->isCollapsedDefault;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:17,代码来源:Fieldset.php

示例14: _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

示例15: _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


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