Skip to content

Commit b297d62

Browse files
author
Serhiy Shkolyarenko
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-59184
2 parents 5709a24 + 1507bb1 commit b297d62

File tree

132 files changed

+5645
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+5645
-388
lines changed

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,12 @@
141141
<type name="Magento\Backend\Model\Menu\Builder">
142142
<plugin name="SetupMenuBuilder" type="Magento\Backend\Model\Setup\MenuBuilder" />
143143
</type>
144+
<type name="Magento\Config\Model\Config\Structure\ConcealInProductionConfigList">
145+
<arguments>
146+
<argument name="configs" xsi:type="array">
147+
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
148+
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
149+
</argument>
150+
</arguments>
151+
</type>
144152
</config>

app/code/Magento/Backup/Controller/Adminhtml/Index/Grid.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
*/
77
namespace Magento\Backup\Controller\Adminhtml\Index;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
911
class Grid extends \Magento\Backup\Controller\Adminhtml\Index
1012
{
1113
/**
1214
* Backup list action
1315
*
14-
* @return void
16+
* @return \Magento\Framework\Controller\ResultInterface
1517
*/
1618
public function execute()
1719
{
18-
$this->_view->loadLayout();
19-
$this->_view->renderLayout();
20+
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
2021
}
2122
}

app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
?>
1515
<?php
1616
$_helper = $this->helper('Magento\Catalog\Helper\Output');
17-
$_product = $block->getProduct()
17+
$_product = $block->getProduct();
1818
?>
1919
<?php if ($_additional = $block->getAdditionalData()): ?>
2020
<div class="additional-attributes-wrapper table-wrapper">

app/code/Magento/CatalogSearch/Controller/Advanced/Index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
*/
77
namespace Magento\CatalogSearch\Controller\Advanced;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
911
class Index extends \Magento\Framework\App\Action\Action
1012
{
1113
/**
12-
* @return void
14+
* @return \Magento\Framework\Controller\ResultInterface
1315
*/
1416
public function execute()
1517
{
16-
$this->_view->loadLayout();
17-
$this->_view->renderLayout();
18+
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
1819
}
1920
}

app/code/Magento/Cms/Model/ResourceModel/Block/Grid/Collection.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,6 @@ public function setAggregations($aggregations)
8484
$this->aggregations = $aggregations;
8585
}
8686

87-
/**
88-
* Retrieve all ids for collection
89-
* Backward compatibility with EAV collection
90-
*
91-
* @param int $limit
92-
* @param int $offset
93-
* @return array
94-
*/
95-
public function getAllIds($limit = null, $offset = null)
96-
{
97-
return $this->getConnection()->fetchCol($this->_getAllIdsSelect($limit, $offset), $this->_bindParams);
98-
}
99-
10087
/**
10188
* Get search criteria.
10289
*
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Config\App\Config\Source;
7+
8+
use Magento\Framework\App\Config\ConfigSourceInterface;
9+
use Magento\Framework\DataObject;
10+
use Magento\Config\Model\Placeholder\PlaceholderFactory;
11+
use Magento\Config\Model\Placeholder\PlaceholderInterface;
12+
use Magento\Framework\Stdlib\ArrayManager;
13+
14+
/**
15+
* Class for retrieving configurations from environment variables.
16+
*/
17+
class EnvironmentConfigSource implements ConfigSourceInterface
18+
{
19+
/**
20+
* Library for working with arrays.
21+
*
22+
* @var ArrayManager
23+
*/
24+
private $arrayManager;
25+
26+
/**
27+
* Object for working with placeholders for environment variables.
28+
*
29+
* @var PlaceholderInterface
30+
*/
31+
private $placeholder;
32+
33+
/**
34+
* @param ArrayManager $arrayManager
35+
* @param PlaceholderFactory $placeholderFactory
36+
*/
37+
public function __construct(
38+
ArrayManager $arrayManager,
39+
PlaceholderFactory $placeholderFactory
40+
) {
41+
$this->arrayManager = $arrayManager;
42+
$this->placeholder = $placeholderFactory->create(PlaceholderFactory::TYPE_ENVIRONMENT);
43+
}
44+
45+
/**
46+
* @inheritdoc
47+
*/
48+
public function get($path = '')
49+
{
50+
$data = new DataObject($this->loadConfig());
51+
return $data->getData($path) ?: [];
52+
}
53+
54+
/**
55+
* Loads config from environment variables.
56+
*
57+
* @return array
58+
*/
59+
private function loadConfig()
60+
{
61+
$config = [];
62+
63+
$environmentVariables = $_ENV;
64+
65+
foreach ($environmentVariables as $template => $value) {
66+
if (!$this->placeholder->isApplicable($template)) {
67+
continue;
68+
}
69+
70+
$config = $this->arrayManager->set(
71+
$this->placeholder->restore($template),
72+
$config,
73+
$value
74+
);
75+
}
76+
77+
return $config;
78+
}
79+
}

app/code/Magento/Config/Block/System/Config/Form.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\App\DeploymentConfig;
1212
use Magento\Framework\App\ObjectManager;
1313
use Magento\Framework\DataObject;
14+
use Magento\Config\Model\Config\Structure\ElementVisibilityInterface;
1415

1516
/**
1617
* System config form block
@@ -113,6 +114,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
113114
*/
114115
private $appConfig;
115116

117+
/**
118+
* Checks visibility status of form elements on Stores > Settings > Configuration page in Admin Panel
119+
* by their paths in the system.xml structure.
120+
*
121+
* @var ElementVisibilityInterface
122+
*/
123+
private $elementVisibility;
124+
116125
/**
117126
* @param \Magento\Backend\Block\Template\Context $context
118127
* @param \Magento\Framework\Registry $registry
@@ -355,7 +364,8 @@ protected function _initElement(
355364
$sharedClass = $this->_getSharedCssClass($field);
356365
$requiresClass = $this->_getRequiresCssClass($field, $fieldPrefix);
357366

358-
$isReadOnly = $this->getSettingChecker()->isReadOnly($path, $this->getScope(), $this->getStringScopeCode());
367+
$isReadOnly = $this->getElementVisibility()->isDisabled($field->getPath())
368+
?: $this->getSettingChecker()->isReadOnly($path, $this->getScope(), $this->getStringScopeCode());
359369
$formField = $fieldset->addField(
360370
$elementId,
361371
$field->getType(),
@@ -805,4 +815,21 @@ private function getAppConfigDataValue($path)
805815
}
806816
return $data->getData($path);
807817
}
818+
819+
/**
820+
* Gets instance of ElementVisibilityInterface.
821+
*
822+
* @return ElementVisibilityInterface
823+
* @deprecated Added to not break backward compatibility of the constructor signature
824+
* by injecting the new dependency directly.
825+
* The method can be removed in a future major release, when constructor signature can be changed.
826+
*/
827+
public function getElementVisibility()
828+
{
829+
if (null === $this->elementVisibility) {
830+
$this->elementVisibility = ObjectManager::getInstance()->get(ElementVisibilityInterface::class);
831+
}
832+
833+
return $this->elementVisibility;
834+
}
808835
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Config\Console\Command\ConfigSet;
7+
8+
use Magento\Config\Console\Command\ConfigSetCommand;
9+
use Magento\Framework\Exception\ConfigurationMismatchException;
10+
use Magento\Framework\ObjectManagerInterface;
11+
12+
/**
13+
* Creates different implementations of config:set processors of type ConfigSetProcessorInterface.
14+
*
15+
* @see ConfigSetProcessorInterface
16+
* @see ConfigSetCommand
17+
*/
18+
class ConfigSetProcessorFactory
19+
{
20+
/**#@+
21+
* Constants for processors.
22+
*
23+
* default - save configuration
24+
* lock - save and lock configuration
25+
*/
26+
const TYPE_DEFAULT = 'default';
27+
const TYPE_LOCK = 'lock';
28+
/**#@-*/
29+
30+
/**
31+
* @var ObjectManagerInterface
32+
*/
33+
private $objectManager;
34+
35+
/**
36+
* List of class names that implement config:set processors
37+
*
38+
* @var array
39+
* @see ConfigSetProcessorInterface
40+
*/
41+
private $processors;
42+
43+
/**
44+
* @param ObjectManagerInterface $objectManager
45+
* @param array $processors
46+
*/
47+
public function __construct(
48+
ObjectManagerInterface $objectManager,
49+
array $processors = []
50+
) {
51+
$this->objectManager = $objectManager;
52+
$this->processors = $processors;
53+
}
54+
55+
/**
56+
* Creates an instance of specified processor.
57+
*
58+
* @param string $processorName The name of processor
59+
* @return ConfigSetProcessorInterface New processor instance
60+
* @throws ConfigurationMismatchException If processor type is not exists in processors array
61+
* or declared class has wrong implementation
62+
*/
63+
public function create($processorName)
64+
{
65+
if (!isset($this->processors[$processorName])) {
66+
throw new ConfigurationMismatchException(__('Class for type "%1" was not declared', $processorName));
67+
}
68+
69+
$object = $this->objectManager->create($this->processors[$processorName]);
70+
71+
if (!$object instanceof ConfigSetProcessorInterface) {
72+
throw new ConfigurationMismatchException(
73+
__('%1 should implement %2', get_class($object), ConfigSetProcessorInterface::class)
74+
);
75+
}
76+
77+
return $object;
78+
}
79+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Config\Console\Command\ConfigSet;
7+
8+
use Magento\Config\Console\Command\ConfigSetCommand;
9+
use Magento\Framework\Exception\CouldNotSaveException;
10+
11+
/**
12+
* Allows to process different flows of config:set command.
13+
*
14+
* @see ConfigSetCommand
15+
*/
16+
interface ConfigSetProcessorInterface
17+
{
18+
/**
19+
* Processes config:set command.
20+
*
21+
* @param string $path The configuration path in format group/section/field_name
22+
* @param string $value The configuration value
23+
* @param string $scope The configuration scope (default, website, or store)
24+
* @param string $scopeCode The scope code
25+
* @return void
26+
* @throws CouldNotSaveException An exception on processing error
27+
*/
28+
public function process($path, $value, $scope, $scopeCode);
29+
}

0 commit comments

Comments
 (0)