Skip to content

Commit eaf875e

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.2-develop
Accepted Public Pull Requests: - #22799: Disable Travis builds - 2.2-develop (by @okorshenko) - #21748: [Backport] Custom option type select - Allow modify list of single selection option types (by @ihor-sviziev)
2 parents 834f1af + 6a83c2e commit eaf875e

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
- [ ] Pull request has a meaningful description of its purpose
3636
- [ ] All commits are accompanied by meaningful commit messages
3737
- [ ] All new or changed code is covered with unit/integration tests (if applicable)
38-
- [ ] All automated tests passed successfully (all builds on Travis CI are green)
38+
- [ ] All automated tests passed successfully (all builds are green)
File renamed without changes.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.2-develop)](https://travis-ci.org/magento/magento2)
21
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
32
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
43
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)

app/code/Magento/Catalog/Model/Product/Option/Type/Select.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
2929
*/
3030
protected $string;
3131

32+
/**
33+
* @var array
34+
*/
35+
private $singleSelectionTypes;
36+
3237
/**
3338
* @param \Magento\Checkout\Model\Session $checkoutSession
3439
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
3540
* @param \Magento\Framework\Stdlib\StringUtils $string
3641
* @param \Magento\Framework\Escaper $escaper
3742
* @param array $data
43+
* @param array $singleSelectionTypes
3844
*/
3945
public function __construct(
4046
\Magento\Checkout\Model\Session $checkoutSession,
4147
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
4248
\Magento\Framework\Stdlib\StringUtils $string,
4349
\Magento\Framework\Escaper $escaper,
44-
array $data = []
50+
array $data = [],
51+
array $singleSelectionTypes = []
4552
) {
4653
$this->string = $string;
4754
$this->_escaper = $escaper;
4855
parent::__construct($checkoutSession, $scopeConfig, $data);
56+
57+
$this->singleSelectionTypes = $singleSelectionTypes ?: [
58+
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
59+
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
60+
];
4961
}
5062

5163
/**
@@ -301,10 +313,6 @@ public function getOptionSku($optionValue, $skuDelimiter)
301313
*/
302314
protected function _isSingleSelection()
303315
{
304-
$single = [
305-
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
306-
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
307-
];
308-
return in_array($this->getOption()->getType(), $single);
316+
return in_array($this->getOption()->getType(), $this->singleSelectionTypes, true);
309317
}
310318
}

app/code/Magento/Catalog/etc/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,4 +1164,12 @@
11641164
</argument>
11651165
</arguments>
11661166
</type>
1167+
<type name="Magento\Catalog\Model\Product\Option\Type\Select">
1168+
<arguments>
1169+
<argument name="singleSelectionTypes" xsi:type="array">
1170+
<item name="drop_down" xsi:type="const">Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN</item>
1171+
<item name="radio" xsi:type="const">Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO</item>
1172+
</argument>
1173+
</arguments>
1174+
</type>
11671175
</config>

0 commit comments

Comments
 (0)