Skip to content

Commit c92a39f

Browse files
committed
Merge pull request #27 from magento-tango/Tango_Pull_Request_Bug_Fixing
[Tango] Bugfixes
2 parents 1f4cf42 + 733006d commit c92a39f

File tree

23 files changed

+794
-106
lines changed

23 files changed

+794
-106
lines changed

Diff for: app/code/Magento/Backend/view/adminhtml/requirejs-config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
var config = {
77
map: {
88
'*': {
9+
editTrigger: 'mage/edit-trigger',
910
translateInline: 'mage/translate-inline',
1011
form: 'mage/backend/form',
1112
button: 'mage/backend/button',
@@ -37,4 +38,4 @@ var config = {
3738
paths: {
3839
"jquery/ui": "jquery/jquery-ui-1.9.2"
3940
}
40-
};
41+
};

Diff for: app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ public function execute()
3838
{
3939
$directive = $this->getRequest()->getParam('___directive');
4040
$directive = $this->urlDecoder->decode($directive);
41-
$url = $this->_objectManager->create('Magento\Email\Model\Template\Filter')->filter($directive);
41+
$imagePath = $this->_objectManager->create('Magento\Cms\Model\Template\Filter')->filter($directive);
4242
/** @var \Magento\Framework\Image\Adapter\AdapterInterface $image */
4343
$image = $this->_objectManager->get('Magento\Framework\Image\AdapterFactory')->create();
4444
$response = $this->getResponse();
4545
try {
46-
$image->open($url);
46+
$image->open($imagePath);
4747
$response->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
4848
} catch (\Exception $e) {
49-
$image->open($this->_objectManager->get('Magento\Cms\Model\Wysiwyg\Config')->getSkinImagePlaceholderUrl());
49+
$imagePath = $this->_objectManager->get('Magento\Cms\Model\Wysiwyg\Config')->getSkinImagePlaceholderPath();
50+
$image->open($imagePath);
5051
$response->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
5152
$this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
5253
}

Diff for: app/code/Magento/Cms/Model/Template/Filter.php

+12
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,16 @@ public function setUseSessionInUrl($flag)
2828
$this->_useSessionInUrl = (bool)$flag;
2929
return $this;
3030
}
31+
32+
/**
33+
* Retrieve media file URL directive
34+
*
35+
* @param string[] $construction
36+
* @return string
37+
*/
38+
public function mediaDirective($construction)
39+
{
40+
$params = $this->_getIncludeParameters($construction[2]);
41+
return $this->_storeManager->getStore()->getBaseMediaDir() . '/' . $params['url'];
42+
}
3143
}

Diff for: app/code/Magento/Cms/Model/Wysiwyg/Config.php

+18-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class Config extends \Magento\Framework\Object
2020
*/
2121
const WYSIWYG_STATUS_CONFIG_PATH = 'cms/wysiwyg/enabled';
2222

23+
/**
24+
*
25+
*/
26+
const WYSIWYG_SKIN_IMAGE_PLACEHOLDER_ID = 'Magento_Cms::images/wysiwyg_skin_image.png';
27+
2328
/**
2429
* Wysiwyg status hidden
2530
*/
@@ -79,6 +84,11 @@ class Config extends \Magento\Framework\Object
7984
*/
8085
protected $_backendUrl;
8186

87+
/**
88+
* @var \Magento\Store\Model\StoreManagerInterface
89+
*/
90+
protected $_storeManager;
91+
8292
/**
8393
* @param \Magento\Backend\Model\UrlInterface $backendUrl
8494
* @param \Magento\Framework\Event\ManagerInterface $eventManager
@@ -87,6 +97,7 @@ class Config extends \Magento\Framework\Object
8797
* @param \Magento\Core\Model\Variable\Config $variableConfig
8898
* @param \Magento\Widget\Model\Widget\Config $widgetConfig
8999
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
100+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
90101
* @param array $windowSize
91102
* @param array $data
92103
*/
@@ -98,6 +109,7 @@ public function __construct(
98109
\Magento\Core\Model\Variable\Config $variableConfig,
99110
\Magento\Widget\Model\Widget\Config $widgetConfig,
100111
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
112+
\Magento\Store\Model\StoreManagerInterface $storeManager,
101113
array $windowSize = [],
102114
array $data = []
103115
) {
@@ -109,6 +121,7 @@ public function __construct(
109121
$this->_variableConfig = $variableConfig;
110122
$this->_widgetConfig = $widgetConfig;
111123
$this->_windowSize = $windowSize;
124+
$this->_storeManager = $storeManager;
112125
parent::__construct($data);
113126
}
114127

@@ -184,13 +197,15 @@ public function getConfig($data = [])
184197
}
185198

186199
/**
187-
* Return URL for skin images placeholder
200+
* Return path for skin images placeholder
188201
*
189202
* @return string
190203
*/
191-
public function getSkinImagePlaceholderUrl()
204+
public function getSkinImagePlaceholderPath()
192205
{
193-
return $this->_assetRepo->getUrl('Magento_Cms::images/wysiwyg_skin_image.png');
206+
$staticPath = $this->_storeManager->getStore()->getBaseStaticDir();
207+
$placeholderPath = $this->_assetRepo->createAsset(self::WYSIWYG_SKIN_IMAGE_PLACEHOLDER_ID)->getPath();
208+
return $staticPath . '/' . $placeholderPath;
194209
}
195210

196211
/**

Diff for: app/code/Magento/PageCache/Controller/Block.php

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@
99

1010
class Block extends \Magento\Framework\App\Action\Action
1111
{
12+
/**
13+
* @var \Magento\Framework\Translate\InlineInterface
14+
*/
15+
protected $translateInline;
16+
17+
/**
18+
* @param \Magento\Framework\App\Action\Context $context
19+
* @param \Magento\Framework\Translate\InlineInterface $translateInline
20+
*/
21+
public function __construct(
22+
\Magento\Framework\App\Action\Context $context,
23+
\Magento\Framework\Translate\InlineInterface $translateInline
24+
) {
25+
parent::__construct($context);
26+
$this->translateInline = $translateInline;
27+
}
28+
1229
/**
1330
* Get blocks from layout by handles
1431
*

Diff for: app/code/Magento/PageCache/Controller/Block/Esi.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function execute()
2828
$response->setHeader('X-Magento-Tags', implode(',', $blockInstance->getIdentities()));
2929
}
3030
}
31+
$this->translateInline->processResponseBody($html);
3132
$response->appendBody($html);
3233
$response->setPublicHeaders($ttl);
3334
}

Diff for: app/code/Magento/PageCache/Controller/Block/Render.php

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function execute()
2727
}
2828

2929
$this->getResponse()->setPrivateHeaders(\Magento\PageCache\Helper\Data::PRIVATE_MAX_AGE_CACHE);
30+
$this->translateInline->processResponseBody($data);
3031
$this->getResponse()->appendBody(json_encode($data));
3132
}
3233
}

Diff for: app/code/Magento/Reports/Model/Event/Observer.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,13 @@ public function catalogProductCompareClear(\Magento\Framework\Event\Observer $ob
216216
public function catalogProductCompareAddProduct(\Magento\Framework\Event\Observer $observer)
217217
{
218218
$productId = $observer->getEvent()->getProduct()->getId();
219-
220-
$this->_productCompFactory->create()->setProductId($productId)->save()->calculate();
221-
219+
$viewData = ['product_id' => $productId];
220+
if ($this->_customerSession->isLoggedIn()) {
221+
$viewData['customer_id'] = $this->_customerSession->getCustomerId();
222+
} else {
223+
$viewData['visitor_id'] = $this->_customerVisitor->getId();
224+
}
225+
$this->_productCompFactory->create()->setData($viewData)->save()->calculate();
222226
return $this->_event(\Magento\Reports\Model\Event::EVENT_PRODUCT_COMPARE, $productId);
223227
}
224228

Diff for: app/code/Magento/Store/Model/Store.php

+20
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,26 @@ public function getBaseUrl($type = \Magento\Framework\UrlInterface::URL_TYPE_LIN
595595
return $this->_baseUrlCache[$cacheKey];
596596
}
597597

598+
/**
599+
* Retrieve base media directory path
600+
*
601+
* @return string
602+
*/
603+
public function getBaseMediaDir()
604+
{
605+
return $this->filesystem->getUri(DirectoryList::MEDIA);
606+
}
607+
608+
/**
609+
* Retrieve base static directory path
610+
*
611+
* @return string
612+
*/
613+
public function getBaseStaticDir()
614+
{
615+
return $this->filesystem->getUri(DirectoryList::STATIC_VIEW);
616+
}
617+
598618
/**
599619
* Append script file name to url in case when server rewrites are disabled
600620
*

Diff for: app/code/Magento/Translation/Block/Js.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function __construct(
4848
*/
4949
public function getTranslatedJson()
5050
{
51-
$json = \Zend_Json::encode($this->dataProvider->getTranslateData());
52-
$this->translateInline->processResponseBody($json, false);
53-
return $json;
51+
$data = $this->dataProvider->getTranslateData();
52+
$this->translateInline->processResponseBody($data);
53+
return \Zend_Json::encode($data);
5454
}
5555
}

Diff for: app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Properties.php

+22-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
class Properties extends \Magento\Widget\Block\Adminhtml\Widget\Options implements
1515
\Magento\Backend\Block\Widget\Tab\TabInterface
1616
{
17+
/**
18+
* Widget config parameters
19+
*
20+
* @var array
21+
*/
22+
protected $hiddenParameters = [
23+
'template'
24+
];
25+
1726
/**
1827
* Prepare label for tab
1928
*
@@ -47,11 +56,21 @@ public function canShowTab()
4756
/**
4857
* Returns status flag about this tab hidden or not
4958
*
50-
* @return true
59+
* @return bool
5160
*/
5261
public function isHidden()
5362
{
54-
return false;
63+
$widgetConfig = $this->getWidgetInstance()->getWidgetConfigAsArray();
64+
65+
if (isset($widgetConfig['parameters'])) {
66+
foreach ($widgetConfig['parameters'] as $key => $parameter) {
67+
if ($parameter['visible'] == 1 && !in_array($key, $this->hiddenParameters)) {
68+
return false;
69+
}
70+
}
71+
}
72+
73+
return true;
5574
}
5675

5776
/**
@@ -88,7 +107,7 @@ protected function _preparelayout()
88107
*/
89108
protected function _addField($parameter)
90109
{
91-
if ($parameter->getKey() != 'template') {
110+
if (!in_array($parameter->getKey(), $this->hiddenParameters)) {
92111
return parent::_addField($parameter);
93112
}
94113
return false;

Diff for: dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2016,9 +2016,10 @@
20162016
['getLinksConfig', 'Magento\Downloadable\Block\Catalog\Product\Links'],
20172017
['getAuthorizationAmounts', 'Magento\Paypal\Model\Config'],
20182018
['cleanTransactions', 'Magento\Paypal\Model\Observer'],
2019+
['getSkinImagePlaceholderUrl', 'Magento\Cms\Model\Wysiwyg\Config'],
20192020
['compareIndexColumnProperties', 'Magento\Catalog\Model\Resource\Helper'],
20202021
['getIsNullNotNullCondition', 'Magento\Catalog\Model\Resource\Helper'],
20212022
['_getCategoryPath', 'Magento\Catalog\Model\Resource\Setup'],
20222023
['_getCategoryEntityRow', 'Magento\Catalog\Model\Resource\Setup'],
2023-
['createEavAttributeResource', 'Magento\Catalog\Model\Resource\Setup'],
2024+
['createEavAttributeResource', 'Magento\Catalog\Model\Resource\Setup']
20242025
];

0 commit comments

Comments
 (0)