Skip to content

Commit c5ea1ba

Browse files
author
Sergey Shvets
committed
Merge branch '2.1-develop' into 2.1.8-develop
2 parents 400f4ee + a386178 commit c5ea1ba

File tree

72 files changed

+1588
-170
lines changed

Some content is hidden

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

72 files changed

+1588
-170
lines changed

app/code/Magento/Catalog/Block/Breadcrumbs.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function getTitleSeparator($store = null)
5454
*/
5555
protected function _prepareLayout()
5656
{
57+
$title = [];
5758
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
5859
$breadcrumbsBlock->addCrumb(
5960
'home',
@@ -64,7 +65,6 @@ protected function _prepareLayout()
6465
]
6566
);
6667

67-
$title = [];
6868
$path = $this->_catalogData->getBreadcrumbPath();
6969

7070
foreach ($path as $name => $breadcrumb) {
@@ -73,7 +73,18 @@ protected function _prepareLayout()
7373
}
7474

7575
$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));
76+
77+
return parent::_prepareLayout();
78+
}
79+
80+
$path = $this->_catalogData->getBreadcrumbPath();
81+
82+
foreach ($path as $name => $breadcrumb) {
83+
$title[] = $breadcrumb['label'];
7684
}
85+
86+
$this->pageConfig->getTitle()->set(join($this->getTitleSeparator(), array_reverse($title)));
87+
7788
return parent::_prepareLayout();
7889
}
7990
}

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ class Helper
7474
* @var \Magento\Framework\Stdlib\DateTime\Filter\DateTime
7575
*/
7676
private $dateTimeFilter;
77+
78+
/**
79+
* @var \Magento\Catalog\Model\Product\LinkTypeProvider
80+
*/
81+
private $linkTypeProvider;
7782

7883
/**
7984
* Helper constructor.
@@ -83,21 +88,25 @@ class Helper
8388
* @param ProductLinks $productLinks
8489
* @param \Magento\Backend\Helper\Js $jsHelper
8590
* @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
91+
* @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
8692
*/
8793
public function __construct(
8894
\Magento\Framework\App\RequestInterface $request,
8995
\Magento\Store\Model\StoreManagerInterface $storeManager,
9096
StockDataFilter $stockFilter,
9197
\Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks $productLinks,
9298
\Magento\Backend\Helper\Js $jsHelper,
93-
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
99+
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
100+
\Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider = null
94101
) {
95102
$this->request = $request;
96103
$this->storeManager = $storeManager;
97104
$this->stockFilter = $stockFilter;
98105
$this->productLinks = $productLinks;
99106
$this->jsHelper = $jsHelper;
100107
$this->dateFilter = $dateFilter;
108+
$this->linkTypeProvider = $linkTypeProvider ?: \Magento\Framework\App\ObjectManager::getInstance()
109+
->get(\Magento\Catalog\Model\Product\LinkTypeProvider::class);
101110
}
102111

103112
/**
@@ -247,11 +256,17 @@ protected function setProductLinks(\Magento\Catalog\Model\Product $product)
247256

248257
$product = $this->productLinks->initializeLinks($product, $links);
249258
$productLinks = $product->getProductLinks();
250-
$linkTypes = [
251-
'related' => $product->getRelatedReadonly(),
252-
'upsell' => $product->getUpsellReadonly(),
253-
'crosssell' => $product->getCrosssellReadonly()
254-
];
259+
$linkTypes = [];
260+
261+
/** @var \Magento\Catalog\Api\Data\ProductLinkTypeInterface $linkTypeObject */
262+
foreach ($this->linkTypeProvider->getItems() as $linkTypeObject) {
263+
$linkTypes[$linkTypeObject->getName()] = $product->getData($linkTypeObject->getName() . '_readonly');
264+
}
265+
266+
// skip linkTypes that were already processed on initializeLinks plugins
267+
foreach ($productLinks as $productLink) {
268+
unset($linkTypes[$productLink->getLinkType()]);
269+
}
255270

256271
foreach ($linkTypes as $linkType => $readonly) {
257272
if (isset($links[$linkType]) && !$readonly) {

0 commit comments

Comments
 (0)