Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 05467af

Browse files
authored
Merge branch 'master' into patch-4
2 parents f1459ad + 870cc6f commit 05467af

File tree

11 files changed

+164
-13
lines changed

11 files changed

+164
-13
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ defaults:
7474
path: mftf/docs
7575
values:
7676
group: mftf
77-
github_files: https://github.com/magento/magento2-functional-testing-framework/blob/develop/
77+
github_files: https://github.com/magento/magento2-functional-testing-framework/blob/master/
7878
github_repo: https://github.com/magento/magento2-functional-testing-framework/
7979
functional_areas:
8080
- Test

_data/toc/php-developer-guide.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,14 @@ pages:
258258
url: /extension-dev-guide/configuration/importers.html
259259

260260
- label: Framework
261-
include_versions: ["2.2", "2.3"]
262261
children:
263262
- label: Serialize Library
263+
include_versions: ["2.2", "2.3"]
264264
url: /extension-dev-guide/framework/serializer.html
265265

266+
- label: Array Manager
267+
url: /extension-dev-guide/framework/array-manager.html
268+
266269
- label: Security
267270
children:
268271

_includes/backward-incompatible-changes/commerce/2.3.1-2.3-develop.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
<h3 id="2.3.1-2.3-develop-class" class="ee-only">Class changes</h3>
2+
<h3 id="2.3.1-2.3-develop-class-ee" class="ee-only">Class changes</h3>
33
<table><tbody>
44
<tr>
55
<th>What changed</th>

_includes/backward-incompatible-changes/open-source/2.3.1-2.3-develop.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,18 @@ <h3 id="2.3.1-2.3-develop-class">Class changes</h3>
153153
<td>Magento\Reports\Model\ResourceModel\Product\Downloads\Collection::getSelectCountSql</td>
154154
<td>[public] Method has been added.</td>
155155
</tr>
156+
<tr>
157+
<td>Magento\Reports\Block\Adminhtml\Grid::__construct</td>
158+
<td>[public] Method has been added.</td>
159+
</tr>
156160
<tr>
157161
<td>Magento\Elasticsearch\Elasticsearch5\SearchAdapter\Query\Builder::$sortBuilder</td>
158162
<td>[protected] Property has been added.</td>
159163
</tr>
164+
<tr>
165+
<td>Magento\Directory\Model\ResourceModel\Country::__construct</td>
166+
<td>[public] Method has been added.</td>
167+
</tr>
160168
<tr>
161169
<td>Magento\CatalogSearch\Model\ResourceModel\Advanced\Collection::setOrder</td>
162170
<td>[public] Method has been added.</td>

guides/v2.1/cloud/cdn/fastly-vcl-whitelist.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ Add the custom VCL snippet to your Fastly service configuration from the Magento
111111
```
112112
113113
1. Click **Create** to generate the VCL snippet file with the name pattern `type_priority_name.vcl`, for example `recv_5_allowlist.vcl`
114-
115-
![Create VCL Snippet]
116114
117115
1. After the page reloads, click **Upload VCL to Fastly** in the *Fastly Configuration* section to add the file to the Fastly service configuration.
118116
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
group: php-developer-guide
3+
title: Array Manager
4+
---
5+
6+
## Overview
7+
8+
The [`Magento\Framework\Stdlib\ArrayManager`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Stdlib/ArrayManager.php){:target="_blank"} library provides the ability to manage deeply nested associative arrays.
9+
The library is primarily used to handle data from UI components within [DataProviders]({{ page.baseurl }}/ui_comp_guide/concepts/ui_comp_data_source.html) and [Modifiers]({{ page.baseurl }}/ui_comp_guide/concepts/ui_comp_modifier_concept.html), which are actually part of a complicated process of parsing XML files in associative arrays.
10+
11+
## Usage
12+
13+
|Method|Description|
14+
|--- |--- |
15+
| `exists` | Checks if the node exists in a given associative array |
16+
| `get` | Returns the value of the key (or node) at the end of the path, `null` is returned if the node hasn't been found. |
17+
| `move` | Moves a value from one path to another |
18+
| `remove` | Removes node and returns modified array |
19+
| `replace` | Updates the existing nodes and returns the modified array |
20+
| `set` | Set value into node and returns modified data |
21+
22+
#### Example 1
23+
24+
The following example shows how to add a custom field to the checkout billing address using the [LayoutProcessor implementation]({{ site.mage2bloburl }}/1f9186c3b9a96c5e642fd5d3d31ac5c7e1877d2b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php#L143){:target="_blank"}.
25+
26+
```php
27+
<?php
28+
/**
29+
* Process js Layout of block
30+
*
31+
* @param array $jsLayout
32+
*
33+
* @return array
34+
*/
35+
public function process($jsLayout)
36+
{
37+
...
38+
39+
if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
40+
['children']['shippingAddress']['children']['shipping-address-fieldset']['children'])
41+
) {
42+
$fields = $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
43+
['children']['shippingAddress']['children']['shipping-address-fieldset']['children'];
44+
45+
...
46+
}
47+
48+
...
49+
}
50+
```
51+
52+
For a cleaner implementation of the previous example, use the `Magento\Framework\Stdlib\ArrayManager`, library to eliminate duplicate checking and get the required array.
53+
54+
```php
55+
<?php
56+
57+
use Magento\Framework\Stdlib\ArrayManager;
58+
59+
...
60+
/**
61+
* @var ArrayManager
62+
*/
63+
private $arrayManager;
64+
65+
/**
66+
* SomeClass constructor.
67+
*
68+
* @param ArrayManager $arrayManager
69+
*/
70+
public function __construct(ArrayManager $arrayManager)
71+
{
72+
$this->arrayManager = $arrayManager;
73+
}
74+
75+
/**
76+
* Process js Layout of block
77+
*
78+
* @param array $jsLayout
79+
*
80+
* @return array
81+
*/
82+
public function process($jsLayout): array
83+
{
84+
$path = 'components/checkout/children/steps/children/shipping-step/children/shippingAddress/children/shipping-address-fieldset/children';
85+
86+
if ($fields = $this->arrayManager->get($path, $jsLayout)) {
87+
...
88+
}
89+
90+
...
91+
}
92+
93+
...
94+
95+
```
96+
97+
#### Example 2
98+
99+
Suppose you have the following nested array:
100+
101+
```php
102+
$data = [
103+
'response' => [
104+
'status' => 'OK',
105+
'result' => [
106+
'items' => [
107+
0 => 'First item',
108+
1 => 'Second item',
109+
...
110+
],
111+
...
112+
]
113+
]
114+
]
115+
```
116+
117+
You can use the `Magento\Framework\Stdlib\ArrayManager` library to access items in the array:
118+
119+
```php
120+
...
121+
122+
if ($this->arrayManager->get('response/status', $data) === 'OK') {
123+
$items = $this->arrayManager->get('response/result/items', $data) ?? [];
124+
125+
foreach ($items as $item) {
126+
...
127+
}
128+
}
129+
130+
...
131+
```

guides/v2.1/frontend-dev-guide/translations/theme_dictionary.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ The locale dictionary would use the default values (keys) in the left column fol
6161
"Card Verification Number", <translation>
6262
```
6363

64+
## Element translations per module
65+
66+
You can translate the same element in different ways for different modules:
67+
68+
```text
69+
"Add to Cart", "Add to Cart", module, Magento_Review
70+
"Add to Cart", "Add to Shopping Cart", module, Magento_Catalog
71+
```
72+
6473
## Additional information
6574

6675
- [Translations overview]

guides/v2.1/javascript-dev-guide/javascript/js_init.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ To call a JS component on an HTML element without direct access to the element o
6767
<script type="text/x-magento-init">
6868
{
6969
// components initialized on the element defined by selector
70-
"<element_selector>": {
71-
"<js_component1>": ...,
72-
"<js_component2>": ...
70+
"<element_selector>": {
71+
"<js_component1>": ...,
72+
"<js_component2>": ...
7373
},
7474
// components initialized without binding to an element
7575
"*": {
@@ -139,8 +139,8 @@ $(function () { // to ensure that code evaluates on page load
139139
$('[data-role=example]') // we expect that page contains markup <tag data-role="example">..</tag>
140140
.accordion({ // now we can use "accordion" as jQuery plugin
141141
header: '[data-role=header]',
142-
content: '[data-role=content]',
143-
trigger: '[data-role=trigger]',
142+
content: '[data-role=content]',
143+
trigger: '[data-role=trigger]',
144144
ajaxUrlElement: 'a'
145145
});
146146
});

guides/v2.1/javascript-dev-guide/widgets/widget_prompt.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The prompt widget can be initialized with or without binding to a certain elemen
2222

2323
```javascript
2424
$('#prompt_init').prompt({
25-
title: 'Prompt title',
25+
title: $.mage.__('Prompt title'),
2626
actions: {
2727
confirm: function(){}, //callback on 'Ok' button click
2828
cancel: function(){}, //callback on 'Cancel' button click
@@ -39,8 +39,8 @@ require([
3939
], function(prompt) { // Variable that represents the `prompt` function
4040

4141
prompt({
42-
title: 'Some title',
43-
content: 'Some content',
42+
title: $.mage.__('Some title'),
43+
content: $.mage.__('Some content'),
4444
actions: {
4545
confirm: function(){},
4646
cancel: function(){},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../v2.1/extension-dev-guide/framework/array-manager.md

0 commit comments

Comments
 (0)