本文整理汇总了PHP中Magento\Framework\Module\Manager::isOutputEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::isOutputEnabled方法的具体用法?PHP Manager::isOutputEnabled怎么用?PHP Manager::isOutputEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Module\Manager
的用法示例。
在下文中一共展示了Manager::isOutputEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _toHtml
/**
* Render block HTML
*
* @return string
*/
protected function _toHtml()
{
if ($this->_moduleManager->isOutputEnabled('Magento_Checkout')) {
return '';
}
return parent::_toHtml();
}
示例2: afterGetOptionArray
/**
* Remove grouped product from list of visible product types
*
* @param \Magento\Catalog\Model\Product\Type $subject
* @param array $result
* @return array
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterGetOptionArray(\Magento\Catalog\Model\Product\Type $subject, array $result)
{
if (!$this->moduleManager->isOutputEnabled('Magento_ConfigurableProduct')) {
unset($result[Configurable::TYPE_CODE]);
}
return $result;
}
示例3: _toHtml
/**
* Render block HTML
*
* @return string
*/
protected function _toHtml()
{
if (!$this->_checkoutHelper->canOnepageCheckout() || !$this->_moduleManager->isOutputEnabled('Magento_Checkout')) {
return '';
}
return parent::_toHtml();
}
示例4: observe
/**
* @param \Magento\Framework\Event $event
* @return void
*/
public function observe($event)
{
if (!$this->moduleManager->isOutputEnabled('Magento_LayeredNavigation')) {
return;
}
/** @var \Magento\Catalog\Block\Adminhtml\Product\Attribute\Grid $grid */
$grid = $event->getGrid();
$grid->addColumnAfter('is_filterable', array('header' => __('Use in Layered Navigation'), 'sortable' => true, 'index' => 'is_filterable', 'type' => 'options', 'options' => array('1' => __('Filterable (with results)'), '2' => __('Filterable (no results)'), '0' => __('No')), 'align' => 'center'), 'is_searchable');
}
示例5: afterGetGroupCollection
/**
* @param \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs $subject
* @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection $result
*
* @return \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterGetGroupCollection(\Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs $subject, $result)
{
if (!$this->_moduleManager->isOutputEnabled('Magento_RecurringPayment')) {
foreach ($result as $key => $group) {
if ($group->getAttributeGroupCode() === 'recurring-payment') {
$result->removeItemByKey($key);
}
}
}
return $result;
}
示例6: execute
/**
* @param \Magento\Framework\Event\Observer $observer
* @return void
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
if (!$this->moduleManager->isOutputEnabled('Magento_LayeredNavigation')) {
return;
}
/** @var \Magento\Framework\Data\Form\AbstractForm $form */
$form = $observer->getForm();
$fieldset = $form->getElement('front_fieldset');
$fieldset->addField('is_filterable', 'select', ['name' => 'is_filterable', 'label' => __("Use in Layered Navigation"), 'title' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'note' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price.'), 'values' => [['value' => '0', 'label' => __('No')], ['value' => '1', 'label' => __('Filterable (with results)')], ['value' => '2', 'label' => __('Filterable (no results)')]]]);
$fieldset->addField('is_filterable_in_search', 'select', ['name' => 'is_filterable_in_search', 'label' => __("Use in Search Results Layered Navigation"), 'title' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'note' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price.'), 'values' => $this->optionList->toOptionArray()]);
$fieldset->addField('position', 'text', ['name' => 'position', 'label' => __('Position'), 'title' => __('Position in Layered Navigation'), 'note' => __('Position of attribute in layered navigation block.'), 'class' => 'validate-digits']);
}
示例7: execute
/**
* @param \Magento\Framework\Event\Observer $observer
* @return void
*/
public function execute(EventObserver $observer)
{
if (!$this->moduleManager->isOutputEnabled('Magento_Swatches')) {
return;
}
/** @var \Magento\Framework\DataObject $response */
$response = $observer->getEvent()->getResponse();
$types = $response->getTypes();
$types[] = ['value' => \Magento\Swatches\Model\Swatch::SWATCH_TYPE_VISUAL_ATTRIBUTE_FRONTEND_INPUT, 'label' => __('Visual Swatch'), 'hide_fields' => ['is_unique', 'is_required', 'frontend_class', '_scope', '_default_value', '_front_fieldset']];
$types[] = ['value' => \Magento\Swatches\Model\Swatch::SWATCH_TYPE_TEXTUAL_ATTRIBUTE_FRONTEND_INPUT, 'label' => __('Text Swatch'), 'hide_fields' => ['is_unique', 'is_required', 'frontend_class', '_scope', '_default_value', '_front_fieldset']];
$response->setTypes($types);
}
示例8: isVisible
/**
* Check a configuration element visibility
*
* @param \Magento\Config\Model\Config\Structure\AbstractElement $element The config composite element
* @param string $scope The element scope
*
* @return bool
*/
public function isVisible(\Magento\Config\Model\Config\Structure\AbstractElement $element, $scope)
{
if ($element->getAttribute('if_module_enabled') && !$this->moduleManager->isOutputEnabled($element->getAttribute('if_module_enabled'))) {
return false;
}
$showInScope = [ContainerScopeInterface::SCOPE_DEFAULT => $element->getAttribute('showInDefault'), ContainerScopeInterface::SCOPE_CONTAINERS => $element->getAttribute('showInContainer'), ContainerScopeInterface::SCOPE_STORE_CONTAINERS => $element->getAttribute('showInStore')];
if ($this->storeManager->isSingleStoreMode()) {
$result = !$element->getAttribute('hide_in_single_store_mode') && array_sum($showInScope);
return $result;
}
return !empty($showInScope[$scope]);
}
示例9: execute
/**
* @param \Magento\Framework\Event\Observer $observer
* @return void
*/
public function execute(EventObserver $observer)
{
if (!$this->moduleManager->isOutputEnabled('Magento_Swatches')) {
return;
}
/** @var \Magento\Framework\Data\Form $form */
$form = $observer->getForm();
$fieldset = $form->getElement('base_fieldset');
$yesnoSource = $this->yesNo->toOptionArray();
$fieldset->addField('update_product_preview_image', 'select', ['name' => 'update_product_preview_image', 'label' => __('Update Product Preview Image'), 'title' => __('Update Product Preview Image'), 'note' => __('Filtering by this attribute will update the product image on catalog page'), 'values' => $yesnoSource], 'is_filterable');
$fieldset->addField('use_product_image_for_swatch', 'select', ['name' => 'use_product_image_for_swatch', 'label' => __('Use Product Image for Swatch if Possible'), 'title' => __('Use Product Image for Swatch if Possible'), 'note' => __('Allows use fallback logic for replacing swatch image with product swatch or base image'), 'values' => $yesnoSource], 'is_filterable');
}
示例10: isModuleOutputEnabled
/**
* Check whether or not the module output is enabled in Configuration
*
* @param string $moduleName Full module name
* @return boolean
* @deprecated use \Magento\Framework\Module\Manager::isOutputEnabled()
*/
public function isModuleOutputEnabled($moduleName = null)
{
if ($moduleName === null) {
$moduleName = $this->_getModuleName();
}
return $this->_moduleManager->isOutputEnabled($moduleName);
}
示例11: convert
/**
* Convert dom node tree to array
*
* @param \DOMDocument $source
* @return array
* @throws \InvalidArgumentException
*/
public function convert($source)
{
$output = ['entities' => []];
/** @var \DOMNodeList $entities */
$entities = $source->getElementsByTagName('entity');
/** @var \DOMNode $entityConfig */
foreach ($entities as $entityConfig) {
$attributes = $entityConfig->attributes;
$name = $attributes->getNamedItem('name')->nodeValue;
$label = $attributes->getNamedItem('label')->nodeValue;
$behaviorModel = $attributes->getNamedItem('behaviorModel')->nodeValue;
$model = $attributes->getNamedItem('model')->nodeValue;
if (!$this->moduleManager->isOutputEnabled(Classes::getClassModuleName($model))) {
continue;
}
$output['entities'][$name] = ['name' => $name, 'label' => $label, 'behaviorModel' => $behaviorModel, 'model' => $model, 'types' => [], 'relatedIndexers' => []];
}
/** @var \DOMNodeList $entityTypes */
$entityTypes = $source->getElementsByTagName('entityType');
/** @var \DOMNode $entityTypeConfig */
foreach ($entityTypes as $entityTypeConfig) {
$attributes = $entityTypeConfig->attributes;
$name = $attributes->getNamedItem('name')->nodeValue;
$model = $attributes->getNamedItem('model')->nodeValue;
$entity = $attributes->getNamedItem('entity')->nodeValue;
if (isset($output['entities'][$entity])) {
$output['entities'][$entity]['types'][$name] = ['name' => $name, 'model' => $model];
}
}
/** @var \DOMNodeList $relatedIndexers */
$relatedIndexers = $source->getElementsByTagName('relatedIndexer');
/** @var \DOMNode $relatedIndexerConfig */
foreach ($relatedIndexers as $relatedIndexerConfig) {
$attributes = $relatedIndexerConfig->attributes;
$name = $attributes->getNamedItem('name')->nodeValue;
$entity = $attributes->getNamedItem('entity')->nodeValue;
if (isset($output['entities'][$entity])) {
$output['entities'][$entity]['relatedIndexers'][$name] = ['name' => $name];
}
}
return $output;
}
示例12: convert
/**
* Convert dom node tree to array
*
* @param \DOMDocument $source
* @return array
* @throws \InvalidArgumentException
*/
public function convert($source)
{
$output = ['entities' => [], 'fileFormats' => []];
/** @var \DOMNodeList $entities */
$entities = $source->getElementsByTagName('entity');
/** @var \DOMNode $entityConfig */
foreach ($entities as $entityConfig) {
$attributes = $entityConfig->attributes;
$name = $attributes->getNamedItem('name')->nodeValue;
$label = $attributes->getNamedItem('label')->nodeValue;
$model = $attributes->getNamedItem('model')->nodeValue;
if (!$this->moduleManager->isOutputEnabled(Classes::getClassModuleName($model))) {
continue;
}
$entityAttributeFilterType = $attributes->getNamedItem('entityAttributeFilterType')->nodeValue;
$output['entities'][$name] = ['name' => $name, 'label' => $label, 'model' => $model, 'types' => [], 'entityAttributeFilterType' => $entityAttributeFilterType];
}
/** @var \DOMNodeList $entityTypes */
$entityTypes = $source->getElementsByTagName('entityType');
/** @var \DOMNode $entityTypeConfig */
foreach ($entityTypes as $entityTypeConfig) {
$attributes = $entityTypeConfig->attributes;
$model = $attributes->getNamedItem('model')->nodeValue;
$name = $attributes->getNamedItem('name')->nodeValue;
$entity = $attributes->getNamedItem('entity')->nodeValue;
if (isset($output['entities'][$entity])) {
$output['entities'][$entity]['types'][$name] = ['name' => $name, 'model' => $model];
}
}
/** @var \DOMNodeList $fileFormats */
$fileFormats = $source->getElementsByTagName('fileFormat');
/** @var \DOMNode $fileFormatConfig */
foreach ($fileFormats as $fileFormatConfig) {
$attributes = $fileFormatConfig->attributes;
$name = $attributes->getNamedItem('name')->nodeValue;
$model = $attributes->getNamedItem('model')->nodeValue;
$label = $attributes->getNamedItem('label')->nodeValue;
$output['fileFormats'][$name] = ['name' => $name, 'model' => $model, 'label' => $label];
}
return $output;
}
示例13: isVisible
/**
* Check whether element should be displayed
*
* @return bool
*/
public function isVisible()
{
if (isset($this->_data['if_module_enabled']) && !$this->moduleManager->isOutputEnabled($this->_data['if_module_enabled'])) {
return false;
}
$showInScope = [\Magento\Store\Model\ScopeInterface::SCOPE_STORE => $this->_hasVisibilityValue('showInStore'), \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE => $this->_hasVisibilityValue('showInWebsite'), ScopeConfigInterface::SCOPE_TYPE_DEFAULT => $this->_hasVisibilityValue('showInDefault')];
if ($this->_storeManager->isSingleStoreMode()) {
$result = !$this->_hasVisibilityValue('hide_in_single_store_mode') && array_sum($showInScope);
return $result;
}
return !empty($showInScope[$this->_scope]);
}
示例14: getModulesByCriteria
/**
* Get Filtered Modules by Options selected
* @param $moduleList
* @param $inputEnabled
* @return array
*/
protected function getModulesByCriteria($moduleList, $inputEnabled)
{
$moduleInfo = array();
$modules = array_intersect_key($this->fullModuleList->getAll(), $moduleList);
foreach ($modules as $module) {
$vendor = current(explode("_", $module['name']));
$title = $module['name'];
$version = $module['setup_version'];
$enabled = $this->moduleManager->isEnabled($title) ? 'Y' : 'N';
$outputEnabled = $this->moduleManager->isOutputEnabled($title) ? 'Y' : 'N';
if ($inputEnabled) {
if ($inputEnabled == strtolower($enabled)) {
$moduleInfo[] = array($vendor, $title, $version, $enabled, $outputEnabled);
}
} else {
$moduleInfo[] = array($vendor, $title, $version, $enabled, $outputEnabled);
}
}
return $moduleInfo;
}
示例15: getModuleData
/**
* Collects required data about the modules
*
* @param bool $refresh
* @return array
*/
public function getModuleData($refresh = true)
{
$callback = function (Module $value) {
return $value->getName();
};
$configModules = $this->getAllModules();
/** @var Module[] $dbModuleArray */
$dbModuleArray = $this->moduleCollectionFactory->create()->getItems();
$nameValues = array_map($callback, $dbModuleArray);
$moduleChanges = [];
foreach ($configModules as $moduleName => $module) {
unset($module['sequence']);
$state = $this->getState($moduleName);
$active = $this->getActive($moduleName);
$module['state'] = $state;
$module['active'] = $active;
if (!in_array($moduleName, $nameValues)) {
$moduleChanges[] = $this->getNewModuleChanges($moduleName, $active, $module['setup_version'], $state);
} else {
$dbModule = $dbModuleArray[array_search($moduleName, $nameValues)];
$changeTest = $dbModule->getData();
$changes = array_diff($module, $changeTest);
$changesCleanArray = $this->getCleanChangesArray($changes);
if (count($changesCleanArray) > 0 || $this->moduleManager->isOutputEnabled($changeTest['name']) && $module['setup_version'] != null) {
$data = ['entity_id' => $changeTest['entity_id'], 'name' => $changeTest['name'], 'active' => $active, 'setup_version' => $module['setup_version'], 'state' => $state];
if ($refresh) {
$dbModule->setData($data);
$dbModule->save();
}
$moduleChanges[] = ['name' => $data['name'], 'setup_version' => $data['setup_version'], 'type' => $state];
}
}
}
$arrayModuleNames = array_keys($configModules);
$uninstalledModuleChanges = $this->setUninstalledModuleChanges($dbModuleArray, $arrayModuleNames);
if (is_array($uninstalledModuleChanges)) {
$moduleChanges[] = $uninstalledModuleChanges;
}
$finalObject = $this->getFinalCounts($moduleChanges);
return $finalObject;
}