Skip to content

Commit 1720c0d

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-l3/magento2ce into ACP2E-1620
2 parents 09cc1f6 + 9c0e123 commit 1720c0d

File tree

40 files changed

+16439
-14358
lines changed

40 files changed

+16439
-14358
lines changed

app/code/Magento/Backend/Test/Mftf/ActionGroup/SecondaryGridActionGroup.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
<waitForPageLoad stepKey="waitForTaxRateLoad"/>
2828

2929
<!-- delete the rule -->
30+
<waitForElementVisible selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="waitForDelete"/>
3031
<click stepKey="clickDelete" selector="{{AdminStoresMainActionsSection.deleteButton}}"/>
32+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmationModal"/>
3133
<click stepKey="clickOk" selector="{{AdminConfirmationModalSection.ok}}"/>
32-
<see stepKey="seeSuccess" selector="{{AdminMessagesSection.success}}" userInput="deleted"/>
34+
<waitForText stepKey="seeSuccess" selector="{{AdminMessagesSection.success}}" userInput="deleted"/>
3335
</actionGroup>
3436
</actionGroups>

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/AttributeOptionProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function getOptions(array $optionIds, ?int $storeId, array $attributeCode
6363
'attribute_id' => 'a.attribute_id',
6464
'attribute_code' => 'a.attribute_code',
6565
'attribute_label' => 'a.frontend_label',
66+
'attribute_type' => 'a.frontend_input',
6667
'position' => 'attribute_configuration.position'
6768
]
6869
)
@@ -137,6 +138,7 @@ private function formatResult(Select $select): array
137138
'attribute_code' => $option['attribute_code'],
138139
'attribute_label' => $option['attribute_store_label']
139140
? $option['attribute_store_label'] : $option['attribute_label'],
141+
'attribute_type' => $option['attribute_type'],
140142
'position' => $option['position'],
141143
'options' => [],
142144
];

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Attribute.php

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\Api\Search\AggregationValueInterface;
1414
use Magento\Framework\Api\Search\BucketInterface;
1515
use Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\Formatter\LayerFormatter;
16+
use Magento\Config\Model\Config\Source\Yesno;
1617

1718
/**
1819
* @inheritdoc
@@ -49,18 +50,26 @@ class Attribute implements LayerBuilderInterface
4950
self::CATEGORY_BUCKET
5051
];
5152

53+
/**
54+
* @var Yesno
55+
*/
56+
private Yesno $YesNo;
57+
5258
/**
5359
* @param AttributeOptionProvider $attributeOptionProvider
5460
* @param LayerFormatter $layerFormatter
61+
* @param Yesno $YesNo
5562
* @param array $bucketNameFilter
5663
*/
5764
public function __construct(
5865
AttributeOptionProvider $attributeOptionProvider,
5966
LayerFormatter $layerFormatter,
67+
Yesno $YesNo,
6068
$bucketNameFilter = []
6169
) {
6270
$this->attributeOptionProvider = $attributeOptionProvider;
6371
$this->layerFormatter = $layerFormatter;
72+
$this->YesNo = $YesNo;
6473
$this->bucketNameFilter = \array_merge($this->bucketNameFilter, $bucketNameFilter);
6574
}
6675

@@ -87,7 +96,11 @@ public function build(AggregationInterface $aggregation, ?int $storeId): array
8796
isset($attribute['position']) ? $attribute['position'] : null
8897
);
8998

90-
$options = $this->getSortedOptions($bucket, isset($attribute['options']) ? $attribute['options'] : []);
99+
$options = $this->getSortedOptions(
100+
$bucket,
101+
isset($attribute['options']) ? $attribute['options'] : [],
102+
($attribute['attribute_type']) ? $attribute['attribute_type']: ''
103+
);
91104
foreach ($options as $option) {
92105
$result[$bucketName]['options'][] = $this->layerFormatter->buildItem(
93106
$option['label'],
@@ -168,9 +181,11 @@ function (AggregationValueInterface $value) {
168181
*
169182
* @param BucketInterface $bucket
170183
* @param array $optionLabels
184+
* @param string $attributeType
171185
* @return array
186+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
172187
*/
173-
private function getSortedOptions(BucketInterface $bucket, array $optionLabels): array
188+
private function getSortedOptions(BucketInterface $bucket, array $optionLabels, string $attributeType): array
174189
{
175190
/**
176191
* Option labels array has been sorted
@@ -179,7 +194,16 @@ private function getSortedOptions(BucketInterface $bucket, array $optionLabels):
179194
foreach ($bucket->getValues() as $value) {
180195
$metrics = $value->getMetrics();
181196
$optionValue = $metrics['value'];
182-
$optionLabel = $optionLabels[$optionValue] ?? $optionValue;
197+
if (isset($optionLabels[$optionValue])) {
198+
$optionLabel = $optionLabels[$optionValue];
199+
} else {
200+
if ($attributeType === 'boolean') {
201+
$yesNoOptions = $this->YesNo->toArray();
202+
$optionLabel = $yesNoOptions[$optionValue];
203+
} else {
204+
$optionLabel = $optionValue;
205+
}
206+
}
183207
$options[$optionValue] = $metrics + ['label' => $optionLabel];
184208
}
185209

@@ -188,7 +212,7 @@ private function getSortedOptions(BucketInterface $bucket, array $optionLabels):
188212
*/
189213
foreach ($options as $optionId => $option) {
190214
if (!is_array($options[$optionId])) {
191-
unset($options[$optionId]);
215+
unset($options[$optionId]);
192216
}
193217
}
194218

app/code/Magento/CatalogGraphQl/Model/AttributesJoiner.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function join(FieldNode $fieldNode, AbstractCollection $collection, Resol
6161
*
6262
* @param FieldNode $fieldNode
6363
* @param ResolveInfo $resolveInfo
64+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
6465
* @return string[]
6566
*/
6667
public function getQueryFields(FieldNode $fieldNode, ResolveInfo $resolveInfo): array
@@ -77,7 +78,11 @@ public function getQueryFields(FieldNode $fieldNode, ResolveInfo $resolveInfo):
7778
($spreadFragmentNode = $resolveInfo->fragments[$field->name->value])) {
7879

7980
foreach ($spreadFragmentNode->selectionSet->selections as $spreadNode) {
80-
if (isset($spreadNode->selectionSet->selections)) {
81+
if (isset($spreadNode->selectionSet->selections)
82+
&& $spreadNode->kind === NodeKind::INLINE_FRAGMENT) {
83+
$fragmentFields[] = $this->addInlineFragmentFields($resolveInfo, $spreadNode);
84+
} elseif (isset($spreadNode->selectionSet->selections)
85+
&& $spreadNode->kind !== NodeKind::INLINE_FRAGMENT) {
8186
$fragmentFields[] = $this->getQueryFields($spreadNode, $resolveInfo);
8287
} else {
8388
$selectedFields[] = $spreadNode->name->value;

app/code/Magento/CatalogGraphQl/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"magento/module-catalog-search": "*",
1515
"magento/framework": "*",
1616
"magento/module-graph-ql": "*",
17+
"magento/module-config": "*",
1718
"magento/module-advanced-search": "*"
1819
},
1920
"suggest": {

app/code/Magento/CatalogGraphQl/etc/module.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<module name="Magento_Store"/>
1414
<module name="Magento_Eav"/>
1515
<module name="Magento_GraphQl"/>
16+
<module name="Magento_Config"/>
1617
<module name="Magento_StoreGraphQl"/>
1718
<module name="Magento_EavGraphQl"/>
1819
</sequence>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CmsGraphQl\Model\Resolver\Page;
9+
10+
use Magento\Cms\Api\Data\PageInterface;
11+
use Magento\Cms\Model\Page;
12+
use Magento\Framework\GraphQl\Query\Resolver\IdentityInterface;
13+
14+
/**
15+
* Identity for resolved CMS page for resolver cache type
16+
*/
17+
class ResolverCacheIdentity implements IdentityInterface
18+
{
19+
/**
20+
* @var string
21+
*/
22+
private $cacheTag = Page::CACHE_TAG;
23+
24+
/**
25+
* Get page ID from resolved data
26+
*
27+
* @param array $resolvedData
28+
* @return string[]
29+
*/
30+
public function getIdentities(array $resolvedData): array
31+
{
32+
return empty($resolvedData[PageInterface::PAGE_ID]) ?
33+
[] : [sprintf('%s_%s', $this->cacheTag, $resolvedData[PageInterface::PAGE_ID])];
34+
}
35+
}

0 commit comments

Comments
 (0)