Skip to content

Commit 2b85232

Browse files
author
Igor Melnikov
authored
Merge pull request #2923 from magento-obsessive-owls/cms-team-1-delivery-sprint-12
[CMS Team 1] Sprint 12 delivery, product attributes block, design data, skipped unstable test
2 parents b22e64d + 3863ed3 commit 2b85232

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

app/code/Magento/Catalog/Block/Product/View/Attributes.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,19 @@ public function getProduct()
6767
}
6868

6969
/**
70-
* $excludeAttr is optional array of attribute codes to
71-
* exclude them from additional data array
70+
* $excludeAttr is optional array of attribute codes to exclude them from additional data array
7271
*
7372
* @param array $excludeAttr
7473
* @return array
75-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
74+
* @throws \Magento\Framework\Exception\LocalizedException
7675
*/
7776
public function getAdditionalData(array $excludeAttr = [])
7877
{
7978
$data = [];
8079
$product = $this->getProduct();
8180
$attributes = $product->getAttributes();
8281
foreach ($attributes as $attribute) {
83-
if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
82+
if ($this->isVisibleOnFrontend($attribute, $excludeAttr)) {
8483
$value = $attribute->getFrontend()->getValue($product);
8584

8685
if ($value instanceof Phrase) {
@@ -100,4 +99,18 @@ public function getAdditionalData(array $excludeAttr = [])
10099
}
101100
return $data;
102101
}
102+
103+
/**
104+
* Determine if we should display the attribute on the front-end
105+
*
106+
* @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
107+
* @param array $excludeAttr
108+
* @return bool
109+
*/
110+
protected function isVisibleOnFrontend(
111+
\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute,
112+
array $excludeAttr
113+
) {
114+
return ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr));
115+
}
103116
}

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuote.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<severity value="CRITICAL"/>
1616
<group value="product"/>
1717
<testCaseId value="MAGETWO-92384"/>
18+
<!-- Skipped due to MAGETWO-93261 -->
19+
<group value="skip"/>
1820
</annotations>
1921
<before>
2022
<createData entity="_defaultCategory" stepKey="createCategory"/>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="Layout" type="page_layout">
12+
<data key="1column">1 column</data>
13+
</entity>
14+
</entities>

0 commit comments

Comments
 (0)