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


PHP UrlInterface::getUrl方法代码示例

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


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

示例1: getUrl

 /**
  * Create url for passed item using passed url model
  *
  * @param \Magento\Framework\Object $item
  * @return string
  */
 public function getUrl($item)
 {
     if (!empty($this->_path)) {
         $params = $this->_prepareParameters($item);
         return $this->_urlModel->getUrl($this->_path, $params);
     }
     return '';
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:UrlGenerator.php

示例2: getElementHtml

 public function getElementHtml()
 {
     $buttonBlock = $this->getForm()->getParent()->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Button');
     $params = ['website' => $buttonBlock->getRequest()->getParam('website')];
     $url = $this->_backendUrl->getUrl("*/*/exportmatrixrate", $params);
     $data = ['label' => __('Export CSV'), 'onclick' => "setLocation('" . $url . "conditionName/' + \$('carriers_matrixrate_condition_name').value + '/matrixrate.csv' )", 'class' => ''];
     $html = $buttonBlock->setData($data)->toHtml();
     return $html;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:9,代码来源:Exportmatrix.php

示例3: execute

 /**
  * Force admin to change password
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if (!$this->observerConfig->isPasswordChangeForced()) {
         return;
     }
     if (!$this->authSession->isLoggedIn()) {
         return;
     }
     $actionList = ['adminhtml_system_account_index', 'adminhtml_system_account_save', 'adminhtml_auth_logout'];
     /** @var \Magento\Framework\App\Action\Action $controller */
     $controller = $observer->getEvent()->getControllerAction();
     /** @var \Magento\Framework\App\RequestInterface $request */
     $request = $observer->getEvent()->getRequest();
     if ($this->authSession->getPciAdminUserIsPasswordExpired()) {
         if (!in_array($request->getFullActionName(), $actionList)) {
             if ($this->authorization->isAllowed('Magento_Backend::myaccount')) {
                 $controller->getResponse()->setRedirect($this->url->getUrl('adminhtml/system_account/'));
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_POST_DISPATCH, true);
             } else {
                 /*
                  * if admin password is expired and access to 'My Account' page is denied
                  * than we need to do force logout with error message
                  */
                 $this->authSession->clearStorage();
                 $this->session->clearStorage();
                 $this->messageManager->addErrorMessage(__('Your password has expired; please contact your administrator.'));
                 $controller->getRequest()->setDispatched(false);
             }
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:38,代码来源:ForceAdminPasswordChangeObserver.php

示例4: eavAttributeChange

 /**
  * Update all attribute-dependant index
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return \Magento\CatalogSearch\Model\Fulltext\Observer
  */
 public function eavAttributeChange(\Magento\Framework\Event\Observer $observer)
 {
     $attribute = $observer->getEvent()->getAttribute();
     /* @var $attribute \Magento\Eav\Model\Entity\Attribute */
     $entityType = $this->_eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY);
     /* @var $entityType \Magento\Eav\Model\Entity\Type */
     if ($attribute->getEntityTypeId() != $entityType->getId()) {
         return $this;
     }
     $delete = $observer->getEventName() == 'eav_entity_attribute_delete_after';
     if (!$delete && !$attribute->dataHasChangedFor('is_searchable')) {
         return $this;
     }
     $showNotice = false;
     if ($delete) {
         if ($attribute->getIsSearchable()) {
             $showNotice = true;
         }
     } elseif ($attribute->dataHasChangedFor('is_searchable')) {
         $showNotice = true;
     }
     if ($showNotice) {
         $url = $this->_backendUrl->getUrl('adminhtml/system_cache');
         $this->messageManager->addNotice(__('Attribute setting change related with Search Index. Please run <a href="%1">Rebuild Search Index</a> process.', $url));
     }
     return $this;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:33,代码来源:Observer.php

示例5: getWidgetWindowUrl

 /**
  * Return Widgets Insertion Plugin Window URL
  *
  * @param \Magento\Framework\DataObject $config Editor element config
  * @return string
  */
 public function getWidgetWindowUrl($config)
 {
     $params = [];
     $skipped = is_array($config->getData('skip_widgets')) ? $config->getData('skip_widgets') : [];
     if ($config->hasData('widget_filters')) {
         $all = $this->_widgetFactory->create()->getWidgets();
         $filtered = $this->_widgetFactory->create()->getWidgets($config->getData('widget_filters'));
         foreach ($all as $code => $widget) {
             if (!isset($filtered[$code])) {
                 $skipped[] = $widget['@']['type'];
             }
         }
     }
     if (count($skipped) > 0) {
         $params['skip_widgets'] = $this->encodeWidgetsToQuery($skipped);
     }
     return $this->_backendUrl->getUrl('adminhtml/widget/index', $params);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:Config.php

示例6: checkNativeTaxRules

 /**
  * Check to see if there are any native tax rules created that may affect AvaTax
  *
  * @return array
  */
 public function checkNativeTaxRules()
 {
     $errors = [];
     if ($this->avaTaxConfig->isModuleEnabled() && $this->avaTaxConfig->getTaxMode($this->storeManager->getDefaultStoreView()) != Config::TAX_MODE_NO_ESTIMATE_OR_SUBMIT && !$this->avaTaxConfig->isNativeTaxRulesIgnored()) {
         $taxRules = $this->taxRuleRepository->getList($this->searchCriteriaBuilder->create());
         if (count($taxRules->getItems())) {
             $errors[] = __('You have %1 native Magento Tax Rule(s) configured. ' . 'Please <a href="%2">review the tax rule(s)</a> and delete any that you do not specifically want enabled. ' . 'You should only have rules setup if you want to use them as backup rules in case of AvaTax ' . 'errors (see <a href="#row_tax_avatax_error_handling_header">Error Action setting</a>) ' . 'or if you need to support VAT tax. ' . '<a href="%3">Ignore this notification</a>.', count($taxRules->getItems()), $this->backendUrl->getUrl('tax/rule'), $this->backendUrl->getUrl('avatax/tax/ignoreTaxRuleNotification'));
         }
     }
     return $errors;
 }
开发者ID:classyllama,项目名称:ClassyLlama_AvaTax,代码行数:16,代码来源:ModuleChecks.php

示例7: getProductSorterLoadUrl

 /**
  * Retrieve the category product sorter load URL.
  *
  * @param Category $category Category.
  *
  * @return string
  */
 private function getProductSorterLoadUrl(Category $category)
 {
     $storeId = $category->getStoreId();
     if ($storeId === 0) {
         $defaultStoreId = $this->storeManager->getDefaultStoreView()->getId();
         $storeId = current(array_filter($category->getStoreIds()));
         if (in_array($defaultStoreId, $category->getStoreIds())) {
             $storeId = $defaultStoreId;
         }
     }
     $urlParams = ['ajax' => true, 'store' => $storeId];
     return $this->urlBuilder->getUrl('virtualcategory/category_virtual/preview', $urlParams);
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:20,代码来源:DataProviderPlugin.php

示例8: _redirectIfNeededAfterLogin

 /**
  * Checks, whether Magento requires redirection after successful admin login, and redirects user, if needed
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInterface $request)
 {
     $requestUri = null;
     // Checks, whether secret key is required for admin access or request uri is explicitly set
     if ($this->_url->useSecretKey()) {
         $requestUri = $this->_url->getUrl('*/*/*', ['_current' => true]);
     } elseif ($request) {
         $requestUri = $request->getRequestUri();
     }
     if (!$requestUri) {
         return false;
     }
     $this->_response->setRedirect($requestUri);
     $this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
     return true;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:22,代码来源:Authentication.php

示例9: _checkExpiredPassword

 /**
  * Check whether the latest password is expired
  * Side-effect can be when passwords were changed with different lifetime configuration settings
  *
  * @param array $latestPassword
  * @return void
  */
 private function _checkExpiredPassword($latestPassword)
 {
     if ($latestPassword && $this->observerConfig->_isLatestPasswordExpired($latestPassword)) {
         if ($this->observerConfig->isPasswordChangeForced()) {
             $message = __('It\'s time to change your password.');
         } else {
             $myAccountUrl = $this->url->getUrl('adminhtml/system_account/');
             $message = __('It\'s time to <a href="%1">change your password</a>.', $myAccountUrl);
         }
         $this->messageManager->addNoticeMessage($message);
         $message = $this->messageManager->getMessages()->getLastAddedMessage();
         if ($message) {
             $message->setIdentifier('magento_user_password_expired')->setIsSticky(true);
             $this->authSession->setPciAdminUserIsPasswordExpired(true);
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:AuthObserver.php

示例10: getConfigSectionsArray

 /**
  * Iterate over all config tabs, extract sections and its subsections
  * @param string $itemsSeparator
  * @param string $itemPrefix
  * @return array
  */
 public function getConfigSectionsArray($itemsSeparator = ' ', $itemPrefix = '')
 {
     $sections = array();
     foreach ($this->_configStructure->getTabs() as $tab) {
         /** @var $tab \Magento\Config\Model\Config\Structure\Element\Tab */
         foreach ($tab->getChildren() as $section) {
             /** @var $section \Magento\Config\Model\Config\Structure\Element\Section */
             // We need the label & url again for the sub sections
             $sectionLabel = $itemPrefix . $tab->getLabel() . $itemsSeparator . $section->getLabel();
             $sectionUrl = $this->_url->getUrl('adminhtml/system_config/edit', array('section' => $section->getId()));
             // First add global section to the launcher items...
             $sections[] = ['label' => $sectionLabel, 'value' => $sectionUrl];
             foreach ($section->getChildren() as $subSection) {
                 /** @var $subSection \Magento\Config\Model\Config\Structure\Element\Section */
                 // ...then add all sub sections
                 $sections[] = ['label' => $sectionLabel . $itemsSeparator . $subSection->getLabel(), 'value' => $sectionUrl . '#' . $section->getId() . '_' . $subSection->getId() . '-link'];
             }
         }
     }
     return $sections;
 }
开发者ID:swnsma,项目名称:magento2,代码行数:27,代码来源:Data.php

示例11: getConfig

 /**
  * Return Wysiwyg config as \Magento\Framework\DataObject
  *
  * Config options description:
  *
  * enabled:                 Enabled Visual Editor or not
  * hidden:                  Show Visual Editor on page load or not
  * use_container:           Wrap Editor contents into div or not
  * no_display:              Hide Editor container or not (related to use_container)
  * translator:              Helper to translate phrases in lib
  * files_browser_*:         Files Browser (media, images) settings
  * encode_directives:       Encode template directives with JS or not
  *
  * @param array|\Magento\Framework\DataObject $data Object constructor params to override default config values
  * @return \Magento\Framework\DataObject
  */
 public function getConfig($data = [])
 {
     $config = new \Magento\Framework\DataObject();
     $config->setData(['enabled' => $this->isEnabled(), 'hidden' => $this->isHidden(), 'use_container' => false, 'add_variables' => true, 'add_widgets' => true, 'no_display' => false, 'encode_directives' => true, 'baseStaticUrl' => $this->_assetRepo->getStaticViewFileContext()->getBaseUrl(), 'baseStaticDefaultUrl' => str_replace('index.php/', '', $this->_backendUrl->getBaseUrl()) . $this->filesystem->getUri(DirectoryList::STATIC_VIEW) . '/', 'directives_url' => $this->_backendUrl->getUrl('cms/wysiwyg/directive'), 'popup_css' => $this->_assetRepo->getUrl('mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'), 'content_css' => $this->_assetRepo->getUrl('mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css'), 'width' => '100%', 'height' => '500px', 'plugins' => []]);
     $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
     if ($this->_authorization->isAllowed('Magento_Cms::media_gallery')) {
         $config->addData(['add_images' => true, 'files_browser_window_url' => $this->_backendUrl->getUrl('cms/wysiwyg_images/index'), 'files_browser_window_width' => $this->_windowSize['width'], 'files_browser_window_height' => $this->_windowSize['height']]);
     }
     if (is_array($data)) {
         $config->addData($data);
     }
     if ($config->getData('add_variables')) {
         $settings = $this->_variableConfig->getWysiwygPluginSettings($config);
         $config->addData($settings);
     }
     if ($config->getData('add_widgets')) {
         $settings = $this->_widgetConfig->getPluginSettings($config);
         $config->addData($settings);
     }
     return $config;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:37,代码来源:Config.php

示例12: getFilesCollection

 /**
  * Return files
  *
  * @param string $path Parent directory path
  * @param string $type Type of storage, e.g. image, media etc.
  * @return \Magento\Framework\Data\Collection\Filesystem
  */
 public function getFilesCollection($path, $type = null)
 {
     if ($this->_coreFileStorageDb->checkDbUsage()) {
         $files = $this->_storageDatabaseFactory->create()->getDirectoryFiles($path);
         /** @var \Magento\MediaStorage\Model\File\Storage\File $fileStorageModel */
         $fileStorageModel = $this->_storageFileFactory->create();
         foreach ($files as $file) {
             $fileStorageModel->saveFile($file);
         }
     }
     $collection = $this->getCollection($path)->setCollectDirs(false)->setCollectFiles(true)->setCollectRecursively(false)->setOrder('mtime', \Magento\Framework\Data\Collection::SORT_ORDER_ASC);
     // Add files extension filter
     if ($allowed = $this->getAllowedExtensions($type)) {
         $collection->setFilesFilter('/\\.(' . implode('|', $allowed) . ')$/i');
     }
     // prepare items
     foreach ($collection as $item) {
         $item->setId($this->_cmsWysiwygImages->idEncode($item->getBasename()));
         $item->setName($item->getBasename());
         $item->setShortName($this->_cmsWysiwygImages->getShortFilename($item->getBasename()));
         $item->setUrl($this->_cmsWysiwygImages->getCurrentUrl() . $item->getBasename());
         if ($this->isImage($item->getBasename())) {
             $thumbUrl = $this->getThumbnailUrl($item->getFilename(), true);
             // generate thumbnail "on the fly" if it does not exists
             if (!$thumbUrl) {
                 $thumbUrl = $this->_backendUrl->getUrl('cms/*/thumbnail', ['file' => $item->getId()]);
             }
             $size = @getimagesize($item->getFilename());
             if (is_array($size)) {
                 $item->setWidth($size[0]);
                 $item->setHeight($size[1]);
             }
         } else {
             $thumbUrl = $this->_assetRepo->getUrl(self::THUMB_PLACEHOLDER_PATH_SUFFIX);
         }
         $item->setThumbUrl($thumbUrl);
     }
     return $collection;
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:46,代码来源:Storage.php

示例13: _getUploadUrl

 /**
  * Get url to upload files
  *
  * @return string
  */
 protected function _getUploadUrl()
 {
     return $this->_url->getUrl('catalog/product_gallery/upload');
 }
开发者ID:aiesh,项目名称:magento2,代码行数:9,代码来源:BaseImage.php

示例14: getUrl

 /**
  * Retrieve menu item url
  *
  * @return string
  */
 public function getUrl()
 {
     if ((bool) $this->_action) {
         return $this->_urlModel->getUrl((string) $this->_action, array('_cache_secret_key' => true));
     }
     return '#';
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Item.php

示例15: getUrl

 /**
  * @param string $path
  * @param array $params
  * @return string
  */
 protected function getUrl($path, $params)
 {
     $isBackendStore = \Magento\Store\Model\Store::DEFAULT_STORE_ID === $this->getStoreId() || \Magento\Store\Model\Store::ADMIN_CODE === $this->getStoreId();
     return $isBackendStore ? $this->backendUrlBuilder->getUrl($path, $params) : $this->_storeManager->getStore($this->getStoreId())->getUrl($path, $params);
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:10,代码来源:Filter.php


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