Skip to content

Commit cc348dc

Browse files
author
olysenko
committed
Merge remote-tracking branch 'origin/develop' into bugfixes
2 parents 1faaad6 + 010156f commit cc348dc

File tree

407 files changed

+12872
-5551
lines changed

Some content is hidden

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

407 files changed

+12872
-5551
lines changed

app/code/Magento/Backend/App/Config.php

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,66 @@
1010

1111
namespace Magento\Backend\App;
1212

13+
use Magento\Config\App\Config\Type\System;
1314
use Magento\Framework\App\Config\ScopeConfigInterface;
1415

1516
/**
16-
* Backend config accessor
17+
* Backend config accessor.
1718
*/
1819
class Config implements ConfigInterface
1920
{
2021
/**
21-
* @var \Magento\Framework\App\Config\ScopePool
22+
* @var \Magento\Framework\App\Config
2223
*/
23-
protected $_scopePool;
24+
protected $appConfig;
2425

2526
/**
26-
* @param \Magento\Framework\App\Config\ScopePool $scopePool
27+
* @var array
2728
*/
28-
public function __construct(\Magento\Framework\App\Config\ScopePool $scopePool)
29+
private $data;
30+
31+
/**
32+
* @param \Magento\Framework\App\Config $appConfig
33+
* @return void
34+
*/
35+
public function __construct(\Magento\Framework\App\Config $appConfig)
2936
{
30-
$this->_scopePool = $scopePool;
37+
$this->appConfig = $appConfig;
3138
}
3239

3340
/**
34-
* Retrieve config value by path and scope
35-
*
36-
* @param string $path
37-
* @return mixed
41+
* @inheritdoc
3842
*/
3943
public function getValue($path)
4044
{
41-
return $this->_scopePool->getScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null)->getValue($path);
45+
if (isset($this->data[$path])) {
46+
return $this->data[$path];
47+
}
48+
49+
$configPath = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
50+
if ($path) {
51+
$configPath .= '/' . $path;
52+
}
53+
return $this->appConfig->get(System::CONFIG_TYPE, $configPath);
4254
}
4355

4456
/**
45-
* Set config value in the corresponding config scope
46-
*
47-
* @param string $path
48-
* @param mixed $value
49-
* @return void
57+
* @inheritdoc
5058
*/
5159
public function setValue($path, $value)
5260
{
53-
$this->_scopePool->getScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null)->setValue($path, $value);
61+
$this->data[$path] = $value;
5462
}
5563

5664
/**
57-
* Retrieve config flag
58-
*
59-
* @param string $path
60-
* @return bool
65+
* @inheritdoc
6166
*/
6267
public function isSetFlag($path)
6368
{
64-
return !!$this->_scopePool->getScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null)->getValue($path);
69+
$configPath = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
70+
if ($path) {
71+
$configPath .= '/' . $path;
72+
}
73+
return (bool) $this->appConfig->get(System::CONFIG_TYPE, $configPath);
6574
}
6675
}

app/code/Magento/Backend/App/ConfigInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface ConfigInterface
1515
/**
1616
* Retrieve config value by path
1717
*
18+
* Path should looks like keys imploded by "/". For example scopes/stores/admin
19+
*
1820
* @param string $path
1921
* @return mixed
2022
* @api
@@ -24,6 +26,7 @@ public function getValue($path);
2426
/**
2527
* Set config value
2628
*
29+
* @deprecated
2730
* @param string $path
2831
* @param mixed $value
2932
* @return void
@@ -34,6 +37,8 @@ public function setValue($path, $value);
3437
/**
3538
* Retrieve config flag
3639
*
40+
* Path should looks like keys imploded by "/". For example scopes/stores/admin
41+
*
3742
* @param string $path
3843
* @return bool
3944
* @api

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
7+
8+
use Magento\Framework\DataObject;
69

710
/**
811
* Backend grid item renderer
9-
*
10-
* @author Magento Core Team <[email protected]>
1112
*/
12-
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
13-
1413
class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
1514
{
1615
/**
@@ -21,30 +20,53 @@ class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe
2120
protected $_variablePattern = '/\\$([a-z0-9_]+)/i';
2221

2322
/**
24-
* Renders grid column
23+
* Get value for the cel
2524
*
26-
* @param \Magento\Framework\DataObject $row
27-
* @return mixed
25+
* @param DataObject $row
26+
* @return string
2827
*/
29-
public function _getValue(\Magento\Framework\DataObject $row)
28+
public function _getValue(DataObject $row)
3029
{
31-
$format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null;
32-
$defaultValue = $this->getColumn()->getDefault();
33-
if ($format === null) {
34-
// If no format and it column not filtered specified return data as is.
35-
$data = parent::_getValue($row);
36-
$string = $data === null ? $defaultValue : $data;
37-
return $this->escapeHtml($string);
38-
} elseif (preg_match_all($this->_variablePattern, $format, $matches)) {
39-
// Parsing of format string
40-
$formattedString = $format;
41-
foreach ($matches[0] as $matchIndex => $match) {
42-
$value = $row->getData($matches[1][$matchIndex]);
43-
$formattedString = str_replace($match, $value, $formattedString);
30+
if (null === $this->getColumn()->getFormat()) {
31+
return $this->getSimpleValue($row);
32+
}
33+
return $this->getFormattedValue($row);
34+
}
35+
36+
/**
37+
* Get simple value
38+
*
39+
* @param DataObject $row
40+
* @return string
41+
*/
42+
private function getSimpleValue(DataObject $row)
43+
{
44+
$data = parent::_getValue($row);
45+
$value = null === $data ? $this->getColumn()->getDefault() : $data;
46+
if (true === $this->getColumn()->getTranslate()) {
47+
$value = __($value);
48+
}
49+
return $this->escapeHtml($value);
50+
}
51+
52+
/**
53+
* Replace placeholders in the string with values
54+
*
55+
* @param DataObject $row
56+
* @return string
57+
*/
58+
private function getFormattedValue(DataObject $row)
59+
{
60+
$value = $this->getColumn()->getFormat() ?: null;
61+
if (true === $this->getColumn()->getTranslate()) {
62+
$value = __($value);
63+
}
64+
if (preg_match_all($this->_variablePattern, $value, $matches)) {
65+
foreach ($matches[0] as $index => $match) {
66+
$replacement = $row->getData($matches[1][$index]);
67+
$value = str_replace($match, $replacement, $value);
4468
}
45-
return $formattedString;
46-
} else {
47-
return $this->escapeHtml($format);
4869
}
70+
return $this->escapeHtml($value);
4971
}
5072
}

app/code/Magento/Backend/Model/Session/Quote.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
use Magento\Customer\Api\CustomerRepositoryInterface;
99
use Magento\Customer\Api\GroupManagementInterface;
10-
use Magento\Framework\App\ObjectManager;
11-
use Magento\Quote\Api\CartManagementInterface;
1210

1311
/**
1412
* Adminhtml quote session
@@ -81,11 +79,6 @@ class Quote extends \Magento\Framework\Session\SessionManager
8179
*/
8280
protected $quoteFactory;
8381

84-
/**
85-
* @var \Magento\Quote\Api\CartManagementInterface;
86-
*/
87-
private $cartManagement;
88-
8982
/**
9083
* @param \Magento\Framework\App\Request\Http $request
9184
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver

app/code/Magento/Backend/Model/Url.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\Model;
77

8+
use Magento\Framework\Url\HostChecker;
9+
use Magento\Framework\App\ObjectManager;
810

911
/**
1012
* Class \Magento\Backend\Model\UrlInterface
@@ -77,6 +79,8 @@ class Url extends \Magento\Framework\Url implements \Magento\Backend\Model\UrlIn
7779
protected $_scope;
7880

7981
/**
82+
* Constructor
83+
*
8084
* @param \Magento\Framework\App\Route\ConfigInterface $routeConfig
8185
* @param \Magento\Framework\App\RequestInterface $request
8286
* @param \Magento\Framework\Url\SecurityInfoInterface $urlSecurityInfo
@@ -96,7 +100,7 @@ class Url extends \Magento\Framework\Url implements \Magento\Backend\Model\UrlIn
96100
* @param \Magento\Store\Model\StoreFactory $storeFactory
97101
* @param \Magento\Framework\Data\Form\FormKey $formKey
98102
* @param array $data
99-
*
103+
* @param HostChecker|null $hostChecker
100104
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
101105
*/
102106
public function __construct(
@@ -118,9 +122,11 @@ public function __construct(
118122
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
119123
\Magento\Store\Model\StoreFactory $storeFactory,
120124
\Magento\Framework\Data\Form\FormKey $formKey,
121-
array $data = []
125+
array $data = [],
126+
HostChecker $hostChecker = null
122127
) {
123128
$this->_encryptor = $encryptor;
129+
$hostChecker = $hostChecker ?: ObjectManager::getInstance()->get(HostChecker::class);
124130
parent::__construct(
125131
$routeConfig,
126132
$request,
@@ -133,7 +139,8 @@ public function __construct(
133139
$scopeConfig,
134140
$routeParamsPreprocessor,
135141
$scopeType,
136-
$data
142+
$data,
143+
$hostChecker
137144
);
138145
$this->_backendHelper = $backendHelper;
139146
$this->_menuConfig = $menuConfig;

0 commit comments

Comments
 (0)