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


PHP Helper\Data类代码示例

本文整理汇总了PHP中Magento\Backend\Helper\Data的典型用法代码示例。如果您正苦于以下问题:PHP Data类的具体用法?PHP Data怎么用?PHP Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getAfterElementHtml

    /**
     * Retrieve additional html and put it at the end of element html
     *
     * @return string
     */
    public function getAfterElementHtml()
    {
        $html = parent::getAfterElementHtml();
        if ($this->getIsWysiwygEnabled()) {
            $disabled = $this->getDisabled() || $this->getReadonly();
            $html .= $this->_layout->createBlock('Magento\\Backend\\Block\\Widget\\Button', '', array('data' => array('label' => __('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, 'class' => $disabled ? 'disabled action-wysiwyg' : 'action-wysiwyg', 'onclick' => 'catalogWysiwygEditor.open(\'' . $this->_backendData->getUrl('catalog/product/wysiwyg') . '\', \'' . $this->getHtmlId() . '\')')))->toHtml();
            $html .= <<<HTML
<script type="text/javascript">
jQuery('#{$this->getHtmlId()}')
    .addClass('wysiwyg-editor')
    .data(
        'wysiwygEditor',
        new tinyMceWysiwygSetup(
            '{$this->getHtmlId()}',
             {
                settings: {
                    theme_advanced_buttons1 : 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
                        'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
                    theme_advanced_buttons2: null,
                    theme_advanced_buttons3: null,
                    theme_advanced_buttons4: null,
                    theme_advanced_statusbar_location: null
                }
            }
        ).turnOn()
    );
</script>
HTML;
        }
        return $html;
    }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:36,代码来源:Wysiwyg.php

示例2: deleteLogoutReasonCookie

 /**
  * Delete cookie with reason of logout
  *
  * @return $this
  */
 public function deleteLogoutReasonCookie()
 {
     $metaData = $this->createCookieMetaData();
     $metaData->setPath('/' . $this->backendData->getAreaFrontName())->setDuration(-1);
     $this->phpCookieManager->setPublicCookie(self::LOGOUT_REASON_CODE_COOKIE_NAME, '', $metaData);
     return $this;
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:12,代码来源:SecurityCookie.php

示例3: __construct

 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param \Magento\Config\Model\Config\Structure $configStructure
  * @param \Magento\Backend\Helper\Data $backendHelper
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Config\Model\Config\Structure $configStructure, \Magento\Backend\Helper\Data $backendHelper, array $data = [])
 {
     $this->_backendHelper = $backendHelper;
     parent::__construct($context, $data);
     $this->_tabs = $configStructure->getTabs();
     $this->setId('system_config_tabs');
     $this->setTitle(__('Configuration'));
     $this->_currentSectionId = $this->getRequest()->getParam('section');
     $this->_backendHelper->addPageHelpUrl($this->getRequest()->getParam('section') . '/');
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:16,代码来源:Tabs.php

示例4: execute

 /**
  * Log out user and redirect him to new admin custom url
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_coreRegistry->registry('custom_admin_path_redirect') === null) {
         return;
     }
     $this->_authSession->destroy();
     $route = $this->_backendData->getAreaFrontName();
     $this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse();
     exit(0);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:17,代码来源:AfterCustomUrlChangedObserver.php

示例5: execute

 /**
  * Log out user and redirect to new admin custom url
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.ExitExpression)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_coreRegistry->registry('custom_admin_path_redirect') === null) {
         return;
     }
     $this->_authSession->destroy();
     $adminUrl = $this->_backendData->getHomePageUrl();
     $this->_response->setRedirect($adminUrl)->sendResponse();
     exit(0);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:AfterCustomUrlChangedObserver.php

示例6: getAfterElementHtml

    /**
     * Retrieve additional html and put it at the end of element html
     *
     * @return string
     */
    public function getAfterElementHtml()
    {
        $config = $this->_wysiwygConfig->getConfig();
        $config = json_encode($config->getData());
        $html = parent::getAfterElementHtml();
        if ($this->getIsWysiwygEnabled()) {
            $disabled = $this->getDisabled() || $this->getReadonly();
            $html .= $this->_layout->createBlock('Magento\\Backend\\Block\\Widget\\Button', '', ['data' => ['label' => __('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, 'class' => 'action-wysiwyg', 'onclick' => 'catalogWysiwygEditor.open(\'' . $this->_backendData->getUrl('catalog/product/wysiwyg') . '\', \'' . $this->getHtmlId() . '\')']])->toHtml();
            $html .= <<<HTML
<script>
require([
    'jquery',
    'mage/adminhtml/wysiwyg/tiny_mce/setup'
], function(jQuery){

var config = {$config},
    editor;

jQuery.extend(config, {
    settings: {
        theme_advanced_buttons1 : 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
            'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
        theme_advanced_buttons2: null,
        theme_advanced_buttons3: null,
        theme_advanced_buttons4: null,
        theme_advanced_statusbar_location: null
    },
    files_browser_window_url: false
});

editor = new tinyMceWysiwygSetup(
    '{$this->getHtmlId()}',
    config
);

editor.turnOn();

jQuery('#{$this->getHtmlId()}')
    .addClass('wysiwyg-editor')
    .data(
        'wysiwygEditor',
        editor
    );
});
</script>
HTML;
        }
        return $html;
    }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:54,代码来源:Wysiwyg.php

示例7: load

 /**
  * Load search results
  *
  * @return $this
  */
 public function load()
 {
     $result = array();
     if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
         $this->setResults($result);
         return $this;
     }
     $collection = $this->_catalogSearchData->getQuery()->getSearchCollection()->addAttributeToSelect('name')->addAttributeToSelect('description')->addBackendSearchFilter($this->getQuery())->setCurPage($this->getStart())->setPageSize($this->getLimit())->load();
     foreach ($collection as $product) {
         $description = strip_tags($product->getDescription());
         $result[] = array('id' => 'product/1/' . $product->getId(), 'type' => __('Product'), 'name' => $product->getName(), 'description' => $this->string->substr($description, 0, 30), 'url' => $this->_adminhtmlData->getUrl('catalog/product/edit', array('id' => $product->getId())));
     }
     $this->setResults($result);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:Catalog.php

示例8: testExecute

 /**
  * @param array $indexerIds
  * @param \Exception $exception
  * @param array $expectsExceptionValues
  * @dataProvider executeDataProvider
  */
 public function testExecute($indexerIds, $exception, $expectsExceptionValues)
 {
     $this->model = new \Magento\Indexer\Controller\Adminhtml\Indexer\MassChangelog($this->contextMock);
     $this->request->expects($this->any())->method('getParam')->with('indexer_ids')->will($this->returnValue($indexerIds));
     if (!is_array($indexerIds)) {
         $this->messageManager->expects($this->once())->method('addError')->with(__('Please select indexers.'))->will($this->returnValue(1));
     } else {
         $this->objectManager->expects($this->any())->method('get')->with('Magento\\Framework\\Indexer\\IndexerRegistry')->will($this->returnValue($this->indexReg));
         $indexerInterface = $this->getMockForAbstractClass('Magento\\Framework\\Indexer\\IndexerInterface', ['setScheduled'], '', false);
         $this->indexReg->expects($this->any())->method('get')->with(1)->will($this->returnValue($indexerInterface));
         if ($exception !== null) {
             $indexerInterface->expects($this->any())->method('setScheduled')->with(true)->will($this->throwException($exception));
         } else {
             $indexerInterface->expects($this->any())->method('setScheduled')->with(true)->will($this->returnValue(1));
         }
         $this->messageManager->expects($this->any())->method('addSuccess')->will($this->returnValue(1));
         if ($exception !== null) {
             $this->messageManager->expects($this->exactly($expectsExceptionValues[2]))->method('addError')->with($exception->getMessage());
             $this->messageManager->expects($this->exactly($expectsExceptionValues[1]))->method('addException')->with($exception, "We couldn't change indexer(s)' mode because of an error.");
         }
     }
     $this->helper->expects($this->any())->method("getUrl")->willReturn("magento.com");
     $this->response->expects($this->any())->method("setRedirect")->willReturn(1);
     $this->model->executeInternal();
 }
开发者ID:nblair,项目名称:magescotch,代码行数:31,代码来源:MassChangelogTest.php

示例9: load

 /**
  * Load search results
  *
  * @return $this
  */
 public function load()
 {
     $result = array();
     if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
         $this->setResults($result);
         return $this;
     }
     $query = $this->getQuery();
     //TODO: add full name logic
     $collection = $this->_collectionFactory->create()->addAttributeToSelect('*')->addAttributeToSearchFilter(array(array('attribute' => 'increment_id', 'like' => $query . '%'), array('attribute' => 'billing_firstname', 'like' => $query . '%'), array('attribute' => 'billing_lastname', 'like' => $query . '%'), array('attribute' => 'billing_telephone', 'like' => $query . '%'), array('attribute' => 'billing_postcode', 'like' => $query . '%'), array('attribute' => 'shipping_firstname', 'like' => $query . '%'), array('attribute' => 'shipping_lastname', 'like' => $query . '%'), array('attribute' => 'shipping_telephone', 'like' => $query . '%'), array('attribute' => 'shipping_postcode', 'like' => $query . '%')))->setCurPage($this->getStart())->setPageSize($this->getLimit())->load();
     foreach ($collection as $order) {
         $result[] = array('id' => 'order/1/' . $order->getId(), 'type' => __('Order'), 'name' => __('Order #%1', $order->getIncrementId()), 'description' => $order->getBillingFirstname() . ' ' . $order->getBillingLastname(), 'form_panel_title' => __('Order #%1 (%2)', $order->getIncrementId(), $order->getBillingFirstname() . ' ' . $order->getBillingLastname()), 'url' => $this->_adminhtmlData->getUrl('sales/order/view', array('order_id' => $order->getId())));
     }
     $this->setResults($result);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:Order.php

示例10: load

 /**
  * Load search results
  *
  * @return $this
  */
 public function load()
 {
     $result = [];
     if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
         $this->setResults($result);
         return $this;
     }
     $this->searchCriteriaBuilder->setCurrentPage($this->getStart());
     $this->searchCriteriaBuilder->setPageSize($this->getLimit());
     $searchFields = ['firstname', 'lastname', 'company'];
     $filters = [];
     foreach ($searchFields as $field) {
         $filters[] = $this->filterBuilder->setField($field)->setConditionType('like')->setValue($this->getQuery() . '%')->create();
     }
     $this->searchCriteriaBuilder->addFilters($filters);
     $searchCriteria = $this->searchCriteriaBuilder->create();
     $searchResults = $this->customerRepository->getList($searchCriteria);
     foreach ($searchResults->getItems() as $customer) {
         $customerAddresses = $customer->getAddresses();
         /** Look for a company name defined in default billing address */
         $company = null;
         foreach ($customerAddresses as $customerAddress) {
             if ($customerAddress->getId() == $customer->getDefaultBilling()) {
                 $company = $customerAddress->getCompany();
                 break;
             }
         }
         $result[] = ['id' => 'customer/1/' . $customer->getId(), 'type' => __('Customer'), 'name' => $this->_customerViewHelper->getCustomerName($customer), 'description' => $company, 'url' => $this->_adminhtmlData->getUrl('customer/index/edit', ['id' => $customer->getId()])];
     }
     $this->setResults($result);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:37,代码来源:Customer.php

示例11: testExecute

 public function testExecute()
 {
     $firstElement = 'firstElement';
     $symbolsDataArray = [$firstElement];
     $redirectUrl = 'redirectUrl';
     $this->requestMock->expects($this->once())->method('getParam')->with('custom_currency_symbol')->willReturn($symbolsDataArray);
     $this->helperMock->expects($this->once())->method('getUrl')->with('*');
     $this->redirectMock->expects($this->once())->method('getRedirectUrl')->willReturn($redirectUrl);
     $this->currencySymbolMock->expects($this->once())->method('setCurrencySymbolsData')->with($symbolsDataArray);
     $this->responseMock->expects($this->once())->method('setRedirect');
     $this->filterManagerMock->expects($this->once())->method('stripTags')->with($firstElement)->willReturn($firstElement);
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\CurrencySymbol\\Model\\System\\Currencysymbol')->willReturn($this->currencySymbolMock);
     $this->objectManagerMock->expects($this->once())->method('get')->with('Magento\\Framework\\Filter\\FilterManager')->willReturn($this->filterManagerMock);
     $this->messageManagerMock->expects($this->once())->method('addSuccess')->with(__('You applied the custom currency symbols.'));
     $this->action->execute();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:SaveTest.php

示例12: getAreaFrontName

 /**
  * Return backend area front name, defined in configuration
  *
  * @return string
  */
 public function getAreaFrontName()
 {
     if (!$this->_getData('area_front_name')) {
         $this->setData('area_front_name', $this->_backendHelper->getAreaFrontName());
     }
     return $this->_getData('area_front_name');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:Url.php

示例13: testGetImageHtmlDeclaration

 /**
  * @param string $baseUrl
  * @param string $fileName
  * @param bool $isUsingStaticUrls
  * @param string $expectedHtml
  * @dataProvider providerGetImageHtmlDeclaration
  */
 public function testGetImageHtmlDeclaration($baseUrl, $fileName, $isUsingStaticUrls, $expectedHtml)
 {
     $directive = '{{media url="/' . $fileName . '"}}';
     $this->generalSettingsGetImageHtmlDeclaration($baseUrl, $isUsingStaticUrls);
     $this->urlEncoderMock->expects($this->any())->method('encode')->with($directive)->willReturn($directive);
     $this->backendDataMock->expects($this->any())->method('getUrl')->with('cms/wysiwyg/directive', ['___directive' => $directive])->willReturn($directive);
     $this->assertEquals($expectedHtml, $this->imagesHelper->getImageHtmlDeclaration($fileName));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:ImagesTest.php

示例14: getValueElementChooserUrl

 /**
  * Retrieve value element chooser URL
  *
  * @return string
  */
 public function getValueElementChooserUrl()
 {
     $url = false;
     switch ($this->getAttribute()) {
         case 'sku':
         case 'category_ids':
             $url = 'catalog_rule/promo_widget/chooser/attribute/' . $this->getAttribute();
             if ($this->getJsFormObject()) {
                 $url .= '/form/' . $this->getJsFormObject();
             }
             break;
         default:
             break;
     }
     return $url !== false ? $this->_backendData->getUrl($url) : '';
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:21,代码来源:AbstractProduct.php

示例15: process

 /**
  * Process path info
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @param string $pathInfo
  * @return string
  */
 public function process(\Magento\Framework\App\RequestInterface $request, $pathInfo)
 {
     $pathParts = explode('/', ltrim($pathInfo, '/'), 2);
     $firstPart = $pathParts[0];
     if ($firstPart != $this->_helper->getAreaFrontName()) {
         return $this->_subject->process($request, $pathInfo);
     }
     return $pathInfo;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:PathInfoProcessor.php


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