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


PHP Data::getUrl方法代码示例

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


在下文中一共展示了Data::getUrl方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: getImageHtmlDeclaration

 /**
  * Prepare Image insertion declaration for Wysiwyg or textarea(as_is mode)
  *
  * @param string $filename Filename transferred via Ajax
  * @param bool $renderAsTag Leave image HTML as is or transform it to controller directive
  * @return string
  */
 public function getImageHtmlDeclaration($filename, $renderAsTag = false)
 {
     $fileurl = $this->getCurrentUrl() . $filename;
     $mediaUrl = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
     $mediaPath = str_replace($mediaUrl, '', $fileurl);
     $directive = sprintf('{{media url="%s"}}', $mediaPath);
     if ($renderAsTag) {
         $html = sprintf('<img src="%s" alt="" />', $this->isUsingStaticUrlsAllowed() ? $fileurl : $directive);
     } else {
         if ($this->isUsingStaticUrlsAllowed()) {
             $html = $fileurl;
             // $mediaPath;
         } else {
             $directive = $this->_coreData->urlEncode($directive);
             $html = $this->_backendData->getUrl('cms/wysiwyg/directive', array('___directive' => $directive));
         }
     }
     return $html;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:26,代码来源:Images.php

示例8: execute

 /**
  * Execute method.
  */
 public function execute()
 {
     $code = $this->getRequest()->getParam('code', false);
     $userId = $this->getRequest()->getParam('state');
     //load admin user
     $adminUser = $this->adminUser->create()->load($userId);
     //app code and admin user must be present
     if ($code && $adminUser->getId()) {
         $clientId = $this->scopeConfig->getValue(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_ID);
         $clientSecret = $this->scopeConfig->getValue(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_SECRET_ID);
         //callback uri if not set custom
         $redirectUri = $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, true);
         $redirectUri .= 'connector/email/callback';
         $data = 'client_id=' . $clientId . '&client_secret=' . $clientSecret . '&redirect_uri=' . $redirectUri . '&grant_type=authorization_code' . '&code=' . $code;
         //callback url
         $url = $this->config->getTokenUrl();
         //@codingStandardsIgnoreStart
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 10);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
         curl_setopt($ch, CURLOPT_POST, count($data));
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
         $response = json_decode(curl_exec($ch));
         if ($response === false) {
             $this->helper->error('Error Number: ' . curl_errno($ch), []);
         }
         if (isset($response->error)) {
             $this->helper->error('OAUTH failed ' . $response->error, []);
         } elseif (isset($response->refresh_token)) {
             //save the refresh token to the admin user
             $adminUser->setRefreshToken($response->refresh_token)->save();
         }
         //@codingStandardsIgnoreEnd
     }
     //redirect to automation index page
     $this->_redirect($this->adminHelper->getUrl('dotdigitalgroup_email/studio'));
 }
开发者ID:dotmailer,项目名称:dotmailer-magento2-extension,代码行数:45,代码来源:Callback.php

示例9: _addDeleteButton

 /**
  * Add delete button
  *
  * @return void
  */
 protected function _addDeleteButton()
 {
     $this->addButton('delete', ['label' => __('Delete'), 'onclick' => 'deleteConfirm(' . json_encode(__('Are you sure you want to do this?')) . ',' . json_encode($this->_adminhtmlData->getUrl('adminhtml/*/delete', ['id' => $this->getUrlRewrite()->getId()])) . ')', 'class' => 'scalable delete', 'level' => -1]);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:9,代码来源:Edit.php

示例10: _getSelectorOptions

 /**
  * Get selector options
  *
  * @return array
  */
 protected function _getSelectorOptions()
 {
     return ['source' => $this->_backendData->getUrl('catalog/category/suggestCategories'), 'valueField' => '#' . $this->getHtmlId(), 'className' => 'category-select', 'multiselect' => true, 'showAll' => true];
 }
开发者ID:aiesh,项目名称:magento2,代码行数:9,代码来源:Category.php

示例11: _formPostInit

 /**
  * Form post init
  *
  * @param \Magento\Framework\Data\Form $form
  * @return $this
  */
 protected function _formPostInit($form)
 {
     $form->setAction($this->_adminhtmlData->getUrl('adminhtml/*/save', ['id' => $this->_getModel()->getId()]));
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:Form.php

示例12: _redirect

 /**
  * Set redirect into response
  *
  * @param   string $path
  * @param   array $arguments
  * @return \Magento\Framework\App\ResponseInterface
  * @TODO move method
  */
 protected function _redirect($path, $arguments = [])
 {
     $this->_session->setIsUrlNotice($this->_flag->get('', \Magento\Backend\App\AbstractAction::FLAG_IS_URLS_CHECKED));
     $this->_response->setRedirect($this->_helper->getUrl($path, $arguments));
     return $this->_response;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:FileFactory.php

示例13: getUrl

 /**
  * Generate url by route and parameters
  *
  * @param   string $route
  * @param   array $params
  * @return  string
  */
 public function getUrl($route = '', $params = [])
 {
     return $this->_helper->getUrl($route, $params);
 }
开发者ID:steverobbins,项目名称:FireGento_FastSimpleImport2,代码行数:11,代码来源:ImportError.php

示例14: _getPreviewUrl

 /**
  * Return Preview/Download URL
  *
  * @return string
  */
 protected function _getPreviewUrl()
 {
     return $this->_adminhtmlData->getUrl('customer/index/viewfile', ['file' => $this->urlEncoder->encode($this->getValue())]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:File.php

示例15: getLoadTreeUrl

 /**
  * Get URL for categories tree ajax loader
  *
  * @return string
  */
 public function getLoadTreeUrl()
 {
     return $this->_adminhtmlData->getUrl('adminhtml/*/categoriesJson');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:Tree.php


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