Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
32e2e4d
Fix meta title property
slackerzz Oct 11, 2017
b11c7e7
Update unit test
slackerzz Oct 12, 2017
474e43c
Fix coding standards
slackerzz Oct 12, 2017
f5e429d
Fixed extends and removed unnecessary variables
Igloczek Mar 27, 2018
6650184
ENGCOM-1207: Fix for not working LESS extends #14395
magento-engcom-team Apr 2, 2018
fd6aa64
Enable WebAPI interface to handle parameters through constructor
phoenix128 Apr 22, 2018
04a53a8
FIX for static tests failure
phoenix128 Apr 22, 2018
6e68edf
Merge branch '2.3-develop' into webapi-support-immutable-construct-pa…
phoenix128 Apr 22, 2018
68e5dcd
FIX static tests, missing declare(strict_types=1)
phoenix128 Apr 22, 2018
a63a3b5
Merge branch 'webapi-support-immutable-construct-params' of github.co…
phoenix128 Apr 22, 2018
3a12905
Fix for displaying a negative price for a custom option. Currently a …
dverkade May 3, 2018
6dff3a5
Correct missing commits for #10210
May 7, 2018
8370e42
ENGCOM-1466: [2.3-develop][Forwardport] Transport variable can not be…
magento-engcom-team May 8, 2018
b168a11
MAGETWO-90652: PayPal BrainTree order fails to checkout with 500 Error
May 8, 2018
54f84cd
ENGCOM-1508: Fix meta title property #11368
magento-engcom-team May 10, 2018
2bff63f
MAGETWO-90663: Error/Exception is thrown when user tries to delete pr…
May 10, 2018
4ed21ae
MAGETWO-91220: Disabling ui-input component isn't work properly
nathanjosiah May 11, 2018
4f0454c
MAGETWO-91220: Select Tab Alignment Visually
nathanjosiah May 11, 2018
d056359
MAGETWO-91220: Disabling ui-input component isn't work properly
nathanjosiah May 11, 2018
f60f088
Merge remote-tracking branch 'upstream/2.3-develop' into MAGETWO-90652
May 11, 2018
a50478b
MAGETWO-90652: PayPal BrainTree order fails to checkout with 500 Error
May 11, 2018
dd3aa38
GraphQL - Added sort by options to Products GraphQL type
zbigniewkuras May 12, 2018
02d6a22
GraphQL - Added missing constructor doc block type for StoreManagerIn…
zbigniewkuras May 12, 2018
089e77a
FIX optional constructor parameter for backward compatiblity
phoenix128 May 13, 2018
fe147c4
ENGCOM-1552: Fix for displaying a negative price for a custom option.…
magento-engcom-team May 14, 2018
ccda08d
MAGETWO-91249: TinyMCE v3.5.8 WYSIWYG as a deprecated module
irenelagno May 14, 2018
33a41ff
Merge branch '2.3-develop' into MAGETWO-89695-tinymce3
irenelagno May 15, 2018
d9fddb8
MAGETWO-90663: Error/Exception is thrown when user tries to delete pr…
dthampy May 15, 2018
89558e7
MAGETWO-90663: Error/Exception is thrown when user tries to delete pr…
dthampy May 15, 2018
d6c15d6
Return full canonical product URL within product object
austris-argalis May 6, 2018
94fb609
Correct docblocks, add api-functional test
austris-argalis May 14, 2018
ac921c7
Update ServiceInputProcessor.php
VladimirZaets May 16, 2018
4426cdb
Enable WebAPI interface
VladimirZaets May 16, 2018
c71b124
ENGCOM-1357: Enable WebAPI interface to handle parameters through con…
magento-engcom-team May 16, 2018
770d8ba
[fix] Property shippingAddress has unknown class Magento\InstantPurch…
May 16, 2018
e03c9a3
[fix] accept null for properties
May 16, 2018
31a098b
[fix] PHPDoc tag param $addressId had none type hint
May 16, 2018
57e3180
[fix] return type in InvalidArgumentException instead of fixed value …
May 16, 2018
08508fa
[fix] missing PHPDoc tag param $storeId
May 16, 2018
ed368b0
Remove duplicated phpdoc comment Fix class variable phpdoc comment Re…
adrian-martinez-interactiv4 May 16, 2018
c4be9d8
ENGCOM-1576: [Forwardport] Fix \Magento\Customer\Model\Customer\Notif…
magento-engcom-team May 16, 2018
e62c574
Merge remote-tracking branch 'upstream/2.3-develop' into MAGETWO-90663
May 16, 2018
37b1835
MAGETWO-71425: Product list configuration with Magento Condition Tree
nathanjosiah May 7, 2018
9035d29
GraphQL - Created separate resolver for sort_fields
zbigniewkuras May 16, 2018
d804bab
GraphQL - Removed unnecessary empty lines.
zbigniewkuras May 16, 2018
3c39047
[Forwardport] Fixed typo in method name
dmytro-ch May 17, 2018
f4bfe4f
ENGCOM-1578: [Forwardport] Fixed typo in method name #15274
magento-engcom-team May 17, 2018
f474471
Merge branch '2.3-develop' into MAGETWO-71425
irenelagno May 17, 2018
f36bb68
MAGETWO-91241: Build stabilization for Product list configuration wit…
irenelagno May 17, 2018
cde5322
MAGETWO-91241: Build stabilization for Product list configuration wit…
irenelagno May 17, 2018
9962c66
GraphQL - Created one resolver for sort_fields. Added tests.
zbigniewkuras May 17, 2018
5c277cf
MAGETWO-91241: Build stabilization for Product list configuration wit…
irenelagno May 17, 2018
c64122b
Merge branch 'MAGETWO-71425' of github.com:magento-trigger/magento2ce…
kieuphan2406 May 17, 2018
f7f2f81
MAGETWO-91241: Build stabilization for Product list configuration wit…
irenelagno May 17, 2018
9ee357f
Merge remote-tracking branch 'trigger/MAGETWO-71425' into MAGETWO-71425
kieuphan2406 May 17, 2018
7f124c6
MAGETWO-71425: Product list configuration with Magento Condition Tree
nathanjosiah May 18, 2018
ca2982e
Merge branch '2.3-develop' into MAGETWO-71425
irenelagno May 18, 2018
17688a1
MAGETWO-91240: Automate MFTF
kieuphan2406 May 18, 2018
1c8579a
Merge remote-tracking branch 'remotes/origin/MAGETWO-89695-tinymce3' …
danmooney2 May 18, 2018
8238fdd
Merge remote-tracking branch 'remotes/origin/MAGETWO-91220' into team…
danmooney2 May 18, 2018
d6011f4
Merge remote-tracking branch 'remotes/origin/MAGETWO-71425' into team…
danmooney2 May 18, 2018
040ab11
MAGETWO-91240: Automate MFTF
kieuphan2406 May 18, 2018
1855062
GraphQL - moved sort_fields to Products object. Some fixes
zbigniewkuras May 18, 2018
76fbe59
Merge remote-tracking branch 'remotes/origin/MAGETWO-91240' into team…
danmooney2 May 18, 2018
dacf294
MAGETWO-91240: Automate MFTF
kieuphan2406 May 18, 2018
c783e1e
MAGETWO-91240: Automate MFTF
kieuphan2406 May 18, 2018
31eaf64
MAGETWO-91240: Automate MFTF
kieuphan2406 May 18, 2018
143022f
Fixed typo in MagentoUi abstract.js
VitaliyBoyko May 19, 2018
df6c7b4
ADHOC: update the contribution templates to include a bit of manners …
dmanners May 19, 2018
b21927f
ENGCOM-1578: [Forwardport] Fixed typo in method name #15274
May 20, 2018
2c8fe5c
ENGCOM-1576: [Forwardport] Fix \Magento\Customer\Model\Customer\Notif…
May 20, 2018
6194406
ENGCOM-1552: Fix for displaying a negative price for a custom option.…
May 20, 2018
24f640a
ENGCOM-1207: Fix for not working LESS extends #14395
May 20, 2018
2e157a9
:arrows_clockwise: [EngCom] Public Pull Requests - 2.3-develop
May 20, 2018
b3ed606
ENGCOM-1466: [2.3-develop][Forwardport] Transport variable can not be…
VladimirZaets May 20, 2018
56cf593
ENGCOM-1357: Enable WebAPI interface to handle parameters through con…
VladimirZaets May 20, 2018
6c04a04
Correct failing test, use urlModel no more
austris-argalis May 20, 2018
b1abc20
[Forwardport] Removed non-existing argument
dmytro-ch May 20, 2018
05456c7
Fixed typo mistake in function comment
sanganinamrata May 18, 2018
39c8364
Removed extra added space in function comment and fixed typo mistakes.
sanganinamrata May 18, 2018
7f29a8f
Revert back file changes
sanganinamrata May 18, 2018
24f6d2e
Revert back file changes.
sanganinamrata May 18, 2018
ebbee92
:arrows_clockwise: [EngCom] Public Pull Requests - 2.3-develop
VladimirZaets May 20, 2018
174e04f
ENGCOM-1613: [Forwardport] Removed non-existing argument #15395
magento-engcom-team May 21, 2018
37edcba
ENGCOM-1615: [Forwardport] Fixed typo mistake in function comment #15397
magento-engcom-team May 21, 2018
ea57f09
ENGCOM-1619: ADHOC: update the contribution templates #15387
magento-engcom-team May 21, 2018
4e945a6
ENGCOM-1619: ADHOC: update the contribution templates #15387
May 21, 2018
571cee7
ENGCOM-1615: [Forwardport] Fixed typo mistake in function comment #15397
May 21, 2018
2411662
ENGCOM-1613: [Forwardport] Removed non-existing argument #15395
May 21, 2018
0461909
ENGCOM-1508: Fix meta title property #11368
May 21, 2018
57b5fdb
:arrows_clockwise: [EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team May 21, 2018
36dd2bf
Merge remote-tracking branch 'origin/MAGETWO-90652' into pr
May 21, 2018
2182c6e
Merge remote-tracking branch 'origin/MAGETWO-90663' into pr
May 21, 2018
cb8464e
ENGCOM-1632: Fixes in InstantPurchase #15257
magento-engcom-team May 21, 2018
a1bd729
MAGETWO-90663: Error/Exception is thrown when user tries to delete pr…
May 21, 2018
1051a82
Merge remote-tracking branch 'origin/MAGETWO-90663' into pr
May 21, 2018
a418a76
ENGCOM-1585: Return full canonical product URL within product object #7
magento-engcom-team May 21, 2018
2633e5a
ENGCOM-1635: GraphQL - Added sort by options to Products GraphQL type…
magento-engcom-team May 21, 2018
85f0bb7
merge magento/2.3-develop into magento-trigger/team3-delivery
May 21, 2018
e1e3fc8
ENGCOM-1635: GraphQL - Added sort by options to Products GraphQL type…
May 21, 2018
602544d
Merge branch 'MAGETWO-91240' into team3-delivery
nathanjosiah May 21, 2018
aae7fbc
Fixed typo in MagentoUi abstract.js
May 21, 2018
b67ff26
ENGCOM-1636: Fixed typo in MagentoUi abstract.js #15370
magento-engcom-team May 21, 2018
aae0b0c
Merge pull request #2573 from magento-borg/pr
May 21, 2018
bd52197
MAGETWO-87492: Adding a script to run 2.3 upgrade steps that need to …
pdohogne-magento May 18, 2018
8a3eb4b
MAGETWO-91240: Automate MFTF
nathanjosiah May 21, 2018
a435536
Merge branch 'team3-delivery' of github.com:magento-trigger/magento2c…
danmooney2 May 21, 2018
7b43b2c
merge magento/2.3-develop into magento-trigger/team3-delivery
May 21, 2018
fa506cf
MAGETWO-91895: Build stabilization
kieuphan2406 May 21, 2018
5a18544
Merge remote-tracking branch 'trigger/team3-delivery' into team3-deli…
kieuphan2406 May 21, 2018
6911734
MAGETWO-91895: Build stabilization
irenelagno May 22, 2018
2a504ce
ENGCOM-1635: GraphQL - Added sort by options to Products GraphQL type…
paliarush May 22, 2018
754ce12
ENGCOM-1585: Return full canonical product URL within product object #7
paliarush May 22, 2018
92c3ac6
Merge pull request #2579 from magento-engcom/2.3-develop-prs
paliarush May 22, 2018
e24769a
ENGCOM-1636: Fixed typo in MagentoUi abstract.js #15370
VladimirZaets May 22, 2018
6270fc0
ENGCOM-1632: Fixes in InstantPurchase #15257
VladimirZaets May 22, 2018
2bde7be
Merge branch '2.3-develop' into team3-delivery
irenelagno May 22, 2018
a7cc288
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-8749…
pdohogne-magento May 22, 2018
70af8a8
Merge pull request #2577 from magento-borg/MAGETWO-87492_2.3-upgrade-…
pdohogne-magento May 22, 2018
4526253
merge magento/2.3-develop into magento-trigger/team3-delivery
May 22, 2018
308bddc
[EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team May 22, 2018
d9f09dd
MAGETWO-90277: Cannot Save Short Description
irenelagno May 22, 2018
4037c51
Merge pull request #2574 from magento-trigger/team3-delivery
irenelagno May 23, 2018
0ac5735
[EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team May 23, 2018
4a61ed6
:arrows_clockwise: [EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team May 23, 2018
1561131
Fixed Purchased Order Form button should visible properly
gelanivishal May 19, 2018
b650a99
Minor styles nesting fix
rogyar May 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
<!--- Provide a general summary of the issue in the Title above -->
<!--- Before adding new issues, please, check this article https://github.com/magento/magento2/wiki/Issue-reporting-guidelines-->
<!---
Thank you for contributing to Magento.
To help us process this issue we recommend that you add the following information:
- Summary of the issue,
- Information on your environment,
- Steps to reproduce,
- Expected and actual results,

Please also have a look at our guidelines article before adding a new issue https://github.com/magento/magento2/wiki/Issue-reporting-guidelines
-->

### Preconditions
<!--- Provide a more detailed information of environment you use -->
<!--- Magento version, tag, HEAD, etc., PHP & MySQL version, etc.. -->
<!---
Please provide as detailed information about your environment as possible.
For example Magento version, tag, HEAD, PHP & MySQL version, etc..
-->
1.
2.

### Steps to reproduce
<!--- Provide a set of unambiguous steps to reproduce this bug include code, if relevant -->
<!---
It is important to provide a set of clear steps to reproduce this bug.
If relevant please include code samples
-->
1.
2.
3.

### Expected result
<!--- Tell us what should happen -->
1.
1. [Screenshot, logs]

### Actual result
<!--- Tell us what happens instead -->
1. [Screenshot, logs]

<!--- (This may be platform independent comment) -->
25 changes: 21 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
<!--- Provide a general summary of the Pull Request in the Title above -->
<!---
Thank you for contributing to Magento.
To help us process this pull request we recommend that you add the following information:
- Summary of the pull request,
- Issue(s) related to the changes made,
- Manual testing scenarios,
-->

<!--- Please provide a general summary of the Pull Request in the Title above -->

### Description
<!--- Provide a description of the changes proposed in the pull request -->
<!---
Please provide a description of the changes proposed in the pull request.
Letting us know what has changed and why it needed changing will help us validate this pull request.
-->

### Fixed Issues (if relevant)
<!--- Provide a list of fixed issues in the format magento/magento2#<issue_number>, if relevant -->
<!---
If relevant, please provide a list of fixed issues in the format magento/magento2#<issue_number>.
There could be 1 or more issues linked here and it will help us find some more information about the reasoning behind this change.
-->
1. magento/magento2#<issue_number>: Issue title
2. ...

### Manual testing scenarios
<!--- Provide a set of unambiguous steps to test the proposed code change -->
<!---
Please provide a set of unambiguous steps to test the proposed code change.
Giving us manual testing scenarios will help with the processing and validation process.
-->
1. ...
2. ...

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Braintree/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
<!-- PayPal value handlers infrastructure -->
<type name="Magento\Braintree\Gateway\Response\PayPal\VaultDetailsHandler">
<arguments>
<argument name="paymentTokenFactory" xsi:type="object">Magento\Vault\Model\AccountPaymentTokenFactory</argument>
<argument name="paymentTokenFactory" xsi:type="object">Magento\Vault\Api\Data\PaymentTokenFactoryInterface</argument>
</arguments>
</type>
<virtualType name="BraintreePayPalValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ public function execute()
->setName($name)
->getAttributeSet();
} catch (AlreadyExistsException $alreadyExists) {
$this->messageManager->addErrorMessage(
__('A "%1" attribute set name already exists. Create a new name and try again.', $name)
);
$this->messageManager->addErrorMessage(__('An attribute set named \'%1\' already exists.', $name));
$this->_session->setAttributeData($data);
return $this->returnResult('catalog/*/edit', ['_current' => true], ['error' => true]);
} catch (LocalizedException $e) {
Expand Down Expand Up @@ -202,6 +200,8 @@ public function execute()
}
}

$data = $this->presentation->convertPresentationDataToInputType($data);

if ($attributeId) {
if (!$model->getId()) {
$this->messageManager->addErrorMessage(__('This attribute no longer exists.'));
Expand All @@ -216,7 +216,7 @@ public function execute()

$data['attribute_code'] = $model->getAttributeCode();
$data['is_user_defined'] = $model->getIsUserDefined();
$data['frontend_input'] = $model->getFrontendInput();
$data['frontend_input'] = $data['frontend_input'] ?? $model->getFrontendInput();
} else {
/**
* @todo add to helper and specify all relations for properties
Expand All @@ -229,8 +229,6 @@ public function execute()
);
}

$data = $this->presentation->convertPresentationDataToInputType($data);

$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0];

if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype;

use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
Expand All @@ -19,9 +21,9 @@ class Presentation
* Get input type for presentation layer from stored input type.
*
* @param Attribute $attribute
* @return string
* @return string|null
*/
public function getPresentationInputType(Attribute $attribute)
public function getPresentationInputType(Attribute $attribute) :?string
{
$inputType = $attribute->getFrontendInput();
if ($inputType == 'textarea' && $attribute->getIsWysiwygEnabled()) {
Expand All @@ -37,12 +39,12 @@ public function getPresentationInputType(Attribute $attribute)
*
* @return array
*/
public function convertPresentationDataToInputType(array $data)
public function convertPresentationDataToInputType(array $data) : array
{
if ($data['frontend_input'] === 'texteditor') {
if (isset($data['frontend_input']) && $data['frontend_input'] === 'texteditor') {
$data['is_wysiwyg_enabled'] = 1;
$data['frontend_input'] = 'textarea';
} elseif ($data['frontend_input'] === 'textarea') {
} elseif (isset($data['frontend_input']) && $data['frontend_input'] === 'textarea') {
$data['is_wysiwyg_enabled'] = 0;
}
return $data;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Test\Unit\Model\Product\Attribute\Frontend\InputType;

class PresentationTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype\Presentation
*/
private $presentation;

/**
* @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute| \PHPUnit_Framework_MockObject_MockObject
*/
private $attributeMock;

protected function setUp()
{
$this->presentation = new \Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype\Presentation();
$this->attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
->disableOriginalConstructor()
->getMock();
}

/**
* @param string $inputType
* @param boolean $isWysiwygEnabled
* @param string $expectedResult
* @dataProvider getPresentationInputTypeDataProvider
*/
public function testGetPresentationInputType(string $inputType, bool $isWysiwygEnabled, string $expectedResult)
{
$this->attributeMock->expects($this->once())->method('getFrontendInput')->willReturn($inputType);
$this->attributeMock->expects($this->any())->method('getIsWysiwygEnabled')->willReturn($isWysiwygEnabled);
$this->assertEquals($expectedResult, $this->presentation->getPresentationInputType($this->attributeMock));
}

public function getPresentationInputTypeDataProvider()
{
return [
'attribute_is_textarea_and_wysiwyg_enabled' => ['textarea', true, 'texteditor'],
'attribute_is_input_and_wysiwyg_enabled' => ['input', true, 'input'],
'attribute_is_textarea_and_wysiwyg_disabled' => ['textarea', false, 'textarea'],
];
}

/**
* @param array $data
* @param array $expectedResult
* @dataProvider convertPresentationDataToInputTypeDataProvider
*/
public function testConvertPresentationDataToInputType(array $data, array $expectedResult)
{
$this->assertEquals($expectedResult, $this->presentation->convertPresentationDataToInputType($data));
}

public function convertPresentationDataToInputTypeDataProvider()
{
return [
[['key' => 'value'], ['key' => 'value']],
[
['frontend_input' => 'texteditor'],
['frontend_input' => 'textarea', 'is_wysiwyg_enabled' => 1]
],
[
['frontend_input' => 'textarea'],
['frontend_input' => 'textarea', 'is_wysiwyg_enabled' => 0]
],
[
['frontend_input' => 'input'],
['frontend_input' => 'input']
]
];
}
}
4 changes: 3 additions & 1 deletion app/code/Magento/Catalog/view/base/web/js/price-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ define([
optionConfig: {},
optionHandlers: {},
optionTemplate: '<%= data.label %>' +
'<% if (data.finalPrice.value) { %>' +
'<% if (data.finalPrice.value > 0) { %>' +
' +<%- data.finalPrice.formatted %>' +
'<% } else if (data.finalPrice.value < 0) { %>' +
' <%- data.finalPrice.formatted %>' +
'<% } %>',
controlContainer: 'dd'
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\CatalogGraphQl\Model\Resolver\Category;

use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Framework\GraphQl\Query\Resolver\ValueFactory;
use Magento\Framework\GraphQl\Query\ResolverInterface;

/**
* Retrieves the sort fields data
*/
class SortFields implements ResolverInterface
{
/**
* @var ValueFactory
*/
private $valueFactory;

/**
* @var \Magento\Catalog\Model\Config
*/
private $catalogConfig;

/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
private $storeManager;

/**
* @var \Magento\Catalog\Model\Category\Attribute\Source\Sortby
*/
private $sortbyAttributeSource;

/**
* @param ValueFactory $valueFactory
* @param \Magento\Catalog\Model\Config $catalogConfig
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @oaram \Magento\Catalog\Model\Category\Attribute\Source\Sortby $sortbyAttributeSource
*/
public function __construct(
ValueFactory $valueFactory,
\Magento\Catalog\Model\Config $catalogConfig,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\Category\Attribute\Source\Sortby $sortbyAttributeSource
) {
$this->valueFactory = $valueFactory;
$this->catalogConfig = $catalogConfig;
$this->storeManager = $storeManager;
$this->sortbyAttributeSource = $sortbyAttributeSource;
}

/**
* {@inheritDoc}
*/
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) : Value
{
$sortFieldsOptions = $this->sortbyAttributeSource->getAllOptions();
array_walk(
$sortFieldsOptions,
function (&$option) {
$option['label'] = (string)$option['label'];
}
);
$data = [
'default' => $this->catalogConfig->getProductListDefaultSortBy($this->storeManager->getStore()->getId()),
'options' => $sortFieldsOptions,
];

$result = function () use ($data) {
return $data;
};

return $this->valueFactory->create($result);
}
}
Loading