本文整理汇总了PHP中Magento\Framework\App\Config\ScopeConfigInterface::isSetFlag方法的典型用法代码示例。如果您正苦于以下问题:PHP ScopeConfigInterface::isSetFlag方法的具体用法?PHP ScopeConfigInterface::isSetFlag怎么用?PHP ScopeConfigInterface::isSetFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Config\ScopeConfigInterface
的用法示例。
在下文中一共展示了ScopeConfigInterface::isSetFlag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isEnabled
/**
* Check whether asset minification is on for specified content type
*
* @param string $contentType
* @return bool
*/
public function isEnabled($contentType)
{
if (!isset($this->configCache[self::XML_PATH_MINIFICATION_ENABLED][$contentType])) {
$this->configCache[self::XML_PATH_MINIFICATION_ENABLED][$contentType] = $this->appState->getMode() != State::MODE_DEVELOPER && (bool) $this->scopeConfig->isSetFlag(sprintf(self::XML_PATH_MINIFICATION_ENABLED, $contentType), $this->scope);
}
return $this->configCache[self::XML_PATH_MINIFICATION_ENABLED][$contentType];
}
示例2: execute
/**
* @return \Magento\Framework\Controller\Result\Forward|\Magento\Framework\View\Result\Page
*/
public function execute()
{
$articleId = (int) $this->getRequest()->getParam('id');
$article = $this->articleFactory->create();
$article->load($articleId);
if (!$article->isActive()) {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
$this->coreRegistry->register('current_article', $article);
$resultPage = $this->resultPageFactory->create();
$title = $article->getMetaTitle() ?: $article->getName();
$resultPage->getConfig()->getTitle()->set($title);
$resultPage->getConfig()->setDescription($article->getMetaDescription());
$resultPage->getConfig()->setKeywords($article->getMetaKeywords());
if ($this->scopeConfig->isSetFlag(self::BREADCRUMBS_CONFIG_PATH, ScopeInterface::SCOPE_STORE)) {
/** @var \Magento\Theme\Block\Html\Breadcrumbs $breadcrumbsBlock */
$breadcrumbsBlock = $resultPage->getLayout()->getBlock('breadcrumbs');
if ($breadcrumbsBlock) {
$breadcrumbsBlock->addCrumb('home', ['label' => __('Home'), 'link' => $this->_url->getUrl('')]);
$breadcrumbsBlock->addCrumb('articles', ['label' => __('Articles'), 'link' => $this->urlModel->getListUrl()]);
$breadcrumbsBlock->addCrumb('article-' . $article->getId(), ['label' => $article->getName()]);
}
}
return $resultPage;
}
示例3: dispatch
/**
* Dispatch request
*
* @param RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
* @throws \Magento\Framework\Exception\NotFoundException
*/
public function dispatch(RequestInterface $request)
{
if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
throw new NotFoundException(__('Page not found.'));
}
return parent::dispatch($request);
}
示例4: scheduledGenerateSitemaps
/**
* Generate sitemaps
*
* @return void
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public function scheduledGenerateSitemaps()
{
$errors = [];
// check if scheduled generation enabled
if (!$this->_scopeConfig->isSetFlag(self::XML_PATH_GENERATION_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
return;
}
$collection = $this->_collectionFactory->create();
/* @var $collection \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection */
foreach ($collection as $sitemap) {
/* @var $sitemap \Magento\Sitemap\Model\Sitemap */
try {
$sitemap->generateXml();
} catch (\Exception $e) {
$errors[] = $e->getMessage();
}
}
if ($errors && $this->_scopeConfig->getValue(self::XML_PATH_ERROR_RECIPIENT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
$translate = $this->_translateModel->getTranslateInline();
$this->_translateModel->setTranslateInline(false);
$this->_transportBuilder->setTemplateIdentifier($this->_scopeConfig->getValue(self::XML_PATH_ERROR_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE))->setTemplateOptions(['area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID])->setTemplateVars(['warnings' => join("\n", $errors)])->setFrom($this->_scopeConfig->getValue(self::XML_PATH_ERROR_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE))->addTo($this->_scopeConfig->getValue(self::XML_PATH_ERROR_RECIPIENT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE));
$transport = $this->_transportBuilder->getTransport();
$transport->sendMessage();
$this->inlineTranslation->resume();
}
}
示例5: execute
/**
* Create Backup
*
* @return $this
*/
public function execute()
{
if (!$this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_ENABLED, ScopeInterface::SCOPE_STORE)) {
return $this;
}
if ($this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE, ScopeInterface::SCOPE_STORE)) {
$this->maintenanceMode->set(true);
}
$type = $this->_scopeConfig->getValue(self::XML_PATH_BACKUP_TYPE, ScopeInterface::SCOPE_STORE);
$this->_errors = [];
try {
$backupManager = $this->_backupFactory->create($type)->setBackupExtension($this->_backupData->getExtensionByType($type))->setTime(time())->setBackupsDir($this->_backupData->getBackupsDir());
$this->_coreRegistry->register('backup_manager', $backupManager);
if ($type != \Magento\Framework\Backup\Factory::TYPE_DB) {
$backupManager->setRootDir($this->_filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath())->addIgnorePaths($this->_backupData->getBackupIgnorePaths());
}
$backupManager->create();
$message = $this->_backupData->getCreateSuccessMessageByType($type);
$this->_logger->info($message);
} catch (\Exception $e) {
$this->_errors[] = $e->getMessage();
$this->_errors[] = $e->getTrace();
$this->_logger->info($e->getMessage());
$this->_logger->critical($e);
}
if ($this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE, ScopeInterface::SCOPE_STORE)) {
$this->maintenanceMode->set(false);
}
return $this;
}
示例6: convertAttribute
/**
* Set current attribute to entry (for specified product)
*
* @param \Magento\Catalog\Model\Product $product
* @param \Magento\Framework\Gdata\Gshopping\Entry $entry
* @return \Magento\Framework\Gdata\Gshopping\Entry
*/
public function convertAttribute($product, $entry)
{
$url = $product->getProductUrl(false);
if ($url) {
$isStoreInUrl = $this->_scopeConfig->isSetFlag(\Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
if (!$isStoreInUrl) {
$urlInfo = parse_url($url);
$store = $product->getStore()->getCode();
if (isset($urlInfo['query']) && $urlInfo['query'] != '') {
$url .= '&___store=' . $store;
} else {
$url .= '?___store=' . $store;
}
}
$links = $entry->getLink();
if (!is_array($links)) {
$links = [];
}
$link = $entry->getService()->newLink();
$link->setHref($url);
$link->setRel('alternate');
$link->setType('text/html');
if ($product->getName()) {
$link->setTitle($product->getName());
}
$links[0] = $link;
$entry->setLink($links);
}
return $entry;
}
示例7: getRequiredAgreementIds
/**
* Get list of required Agreement Ids
*
* @return int[]
*/
public function getRequiredAgreementIds()
{
if (!$this->scopeConfig->isSetFlag(self::PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
return [];
} else {
return $this->agreementCollectionFactory->create()->addStoreFilter($this->storeManager->getStore()->getId())->addFieldToFilter('is_active', 1)->getAllIds();
}
}
示例8: getConfig
/**
* {@inheritdoc}
*/
public function getConfig()
{
$isAgreementsEnabled = $this->scopeConfiguration->isSetFlag(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE);
if ($isAgreementsEnabled && count($this->checkoutAgreementsRepository->getList()) > 0) {
return ['checkoutAgreementsEnabled' => true];
}
return [];
}
示例9: getConfig
/**
* {@inheritdoc}
*/
public function getConfig()
{
if ($this->scopeConfiguration->isSetFlag(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
return ['checkoutAgreementsEnabled' => true];
} else {
return [];
}
}
示例10: sendEmailConfirmation
/**
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @param string $redirectUrl
*
* @return $this
*/
public function sendEmailConfirmation(\Magento\Customer\Api\Data\CustomerInterface $customer, $redirectUrl)
{
$storeId = $this->getWebsiteStoreId($customer);
if ($this->scopeConfig->isSetFlag(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DISABLE_CUSTOMER_SUCCESS, 'store', $storeId)) {
return $this;
} else {
parent::sendEmailConfirmation($customer, $redirectUrl);
}
}
示例11: create
/**
* @param array $data
* @return object
*/
public function create(array $data = [])
{
if ($this->scopeConfig->isSetFlag(Payupl::XML_PATH_CLASSIC_API, 'store')) {
$class = Client\Classic::class;
} else {
$class = Client\Rest::class;
}
return $this->objectManager->create($class, []);
}
示例12: build
/**
* Build index query
*
* @param RequestInterface $request
* @return Select
*/
public function build(RequestInterface $request)
{
$select = $this->getSelect()->from(['search_index' => $this->resource->getTableName($request->getIndex())], ['entity_id' => 'search_index.product_id'])->joinLeft(['category_index' => $this->resource->getTableName('catalog_category_product_index')], 'search_index.product_id = category_index.product_id' . ' AND search_index.store_id = category_index.store_id', []);
$isShowOutOfStock = $this->config->isSetFlag('cataloginventory/options/show_out_of_stock', ScopeInterface::SCOPE_STORE);
if ($isShowOutOfStock === false) {
$select->joinLeft(['stock_index' => $this->resource->getTableName('cataloginventory_stock_status')], 'search_index.product_id = stock_index.product_id' . $this->getReadConnection()->quoteInto(' AND stock_index.website_id = ?', $this->storeManager->getWebsite()->getId()), [])->where('stock_index.stock_status = ?', 1);
}
return $select;
}
示例13: getAgreementsConfig
/**
* Returns agreements config
*
* @return array
*/
protected function getAgreementsConfig()
{
$agreementConfiguration = [];
$isAgreementsEnabled = $this->scopeConfiguration->isSetFlag(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE);
$agreementsList = $this->checkoutAgreementsRepository->getList();
$agreementConfiguration['isEnabled'] = (bool) ($isAgreementsEnabled && count($agreementsList) > 0);
foreach ($agreementsList as $agreement) {
$agreementConfiguration['agreements'][] = ['content' => $agreement->getIsHtml() ? $agreement->getContent() : nl2br($this->escaper->escapeHtml($agreement->getContent())), 'checkboxText' => $agreement->getCheckboxText(), 'mode' => $agreement->getMode(), 'agreementId' => $agreement->getAgreementId()];
}
return $agreementConfiguration;
}
示例14: execute
/**
* @param \Magento\Framework\Event\Observer $observer
* @return void
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var Category $category */
$category = $observer->getEvent()->getCategory();
if ($category->dataHasChangedFor('parent_id')) {
$saveRewritesHistory = $this->scopeConfig->isSetFlag(UrlKeyRenderer::XML_PATH_SEO_SAVE_HISTORY, ScopeInterface::SCOPE_STORE, $category->getStoreId());
$category->setData('save_rewrites_history', $saveRewritesHistory);
$urlRewrites = array_merge($this->categoryUrlRewriteGenerator->generate($category), $this->urlRewriteHandler->generateProductUrlRewrites($category));
$this->urlRewriteHandler->deleteCategoryRewritesForChildren($category);
$this->urlPersist->replace($urlRewrites);
}
}
示例15: getRequiredAgreementIds
/**
* Get list of required Agreement Ids
*
* @return int[]
*/
public function getRequiredAgreementIds()
{
$agreementIds = [];
if ($this->scopeConfig->isSetFlag(self::PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
$agreementCollection = $this->agreementCollectionFactory->create();
$agreementCollection->addStoreFilter($this->storeManager->getStore()->getId());
$agreementCollection->addFieldToFilter('is_active', 1);
$agreementCollection->addFieldToFilter('mode', AgreementModeOptions::MODE_MANUAL);
$agreementIds = $agreementCollection->getAllIds();
}
return $agreementIds;
}