Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bdc2daa

Browse files
committed
Merge master
2 parents 936c21d + 667192d commit bdc2daa

File tree

4 files changed

+75
-8
lines changed

4 files changed

+75
-8
lines changed

src/guides/v2.3/ext-best-practices/tutorials/dynamic-row-system-config.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,71 @@ class TaxColumn extends Select
171171

172172
This block sets values for the drop-down option.
173173

174-
## Step 4: Clean cache
174+
## Step 4: Set default values - OPTIONAL
175+
176+
It is possible to set defaults for a dynamic row configuration, this is done by adding additional XML to the defaults block in the `config.xml` file for the module.
177+
178+
Add a block to the `<default>` section of the `config.xml` file and do not include any values:
179+
180+
```xml
181+
<system>
182+
<general>
183+
<ranges></ranges>
184+
</general>
185+
</system>
186+
```
187+
188+
For each complete line of configuration, create an XML block with a repeating node that has a different value to all the others and contains XML tags for each sub-option and value.
189+
For example, you can use `<item1>, <item2>`.
190+
191+
The sub-options are the columns defined in the `_prepareToRender()` method as described in [Step 2](#step-2-create-the-block-class-to-describe-custom-field-columns).
192+
193+
In the following excerpt, a single row for `item1` contains 4 sub-options:
194+
195+
```xml
196+
<item1>
197+
<from_qty>5</from_qty>
198+
<to_qty>6</to_qty>
199+
<price>10.00</price>
200+
<tax>1</tax>
201+
</item1>
202+
```
203+
204+
Continue building the default block by adding 3 items to the `ranges` configuration option in the `config.xml` file:
205+
206+
```xml
207+
<system>
208+
<general>
209+
<ranges>
210+
<item1>
211+
<from_qty>1</from_qty>
212+
<to_qty>5</to_qty>
213+
<price>10.00</price>
214+
<tax>1</tax>
215+
</item1>
216+
<item2>
217+
<from_qty>6</from_qty>
218+
<to_qty>10</to_qty>
219+
<price>20.00</price>
220+
<tax>1</tax>
221+
</item2>
222+
<item3>
223+
<from_qty>11</from_qty>
224+
<to_qty>15</to_qty>
225+
<price>30.00</price>
226+
<tax>0</tax>
227+
</item3>
228+
</ranges>
229+
</general>
230+
</system>
231+
```
232+
233+
To verify the default values for the configuration are correct, do the following :
234+
235+
- Ensure that this configuration option has no entry in the database.
236+
- Continue with Step 5
237+
238+
## Step 5: Clean cache
175239

176240
Clean the Magento cache with the following command:
177241

@@ -186,7 +250,7 @@ bin/magento cache:clean config
186250

187251
## Result
188252

189-
The result is a new dynamic system row field in the Admin panel.
253+
The result is a new dynamic system row field in the Admin panel. If you have set optional default values, these should also appear.
190254

191255
![Dynamic Rows System Config]({{ site.baseurl }}/common/images/ext-best-practices/dynamic-rows-config-result.png)
192256

src/guides/v2.3/frontend-dev-guide/layouts/layout-practice.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The Luma theme [moves]({{ page.baseurl }}/frontend-dev-guide/layouts/xml-instruc
9797

9898
```xml
9999
<referenceBlock name="header.links">
100-
<block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" before="-"/>
100+
<block class="Magento\Customer\Block\Account\Customer" name="customer" template="Magento_Customer::account/customer.phtml" before="-"/>
101101
...
102102
</referenceBlock>
103103
...
@@ -198,8 +198,8 @@ To move the links to the `header.links` block, OrangeCo adds an extending layout
198198
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
199199
<body>
200200
<referenceBlock name="header.links">
201-
<block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" before="-"/>
202-
<block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" template="account/link/authorization.phtml"/>
201+
<block class="Magento\Customer\Block\Account\Customer" name="customer" template="Magento_Customer::account/customer.phtml" before="-"/>
202+
<block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" template="Magento_Customer::account/link/authorization.phtml"/>
203203
</referenceBlock>
204204
<move element="register-link" destination="header.links"/>
205205
<move element="top.links" destination="customer"/>

src/guides/v2.3/frontend-dev-guide/layouts/xml-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ We recommend always adding a `name` to blocks. Otherwise, it is given a random n
6565
| `name` | Name that can be used to address the block to which this attribute is assigned. The name must be unique per generated page. If not specified, an automatic name will be assigned in the format <code>ANONYMOUS_<em>n</em></code> | 0-9, A-Z, a-z, underscore (_), period (.), dash (-). Should start with a letter. Case-sensitive. | no |
6666
| `before` | Used to position the block before an element under the same parent. The element name or alias name is specified in the value. Use dash (-) to position the block before all other elements of its level of nesting. See [before and after attributes](#fedg_xml-instrux_before-after) for details. | Element name or dash (-) | no |
6767
| `after` | Used to position the block after an element under the same parent. The element name or alias name is specified in the value. Use dash (-) to position the block after all other elements of its level of nesting. See [before and after attributes](#fedg_xml-instrux_before-after) for details. | Element name or dash (-) | no |
68-
| `template` | A template that represents the functionality of the block to which this attribute is assigned. | `Vendor_Module::path/to/template.phtml` (Scope is already in the `templates` directory of the module) | no |
68+
| `template` | A template that represents the functionality of the block to which this attribute is assigned. If the attribute is omitted, the block will not render any output. | `Vendor_Module::path/to/template.phtml` (Scope is already in the `templates` directory of the module) | no |
6969
| `as` | An alias name that serves as identifier in the scope of the parent element. | 0-9, A-Z, a-z, underscore (_), period (.), dash (-). Case-sensitive. | no |
7070
| `cacheable` | Defines whether a block element is cacheable. This can be used for development purposes and to make needed elements of the page dynamic. | `true` or `false`. Defaults to `true`. | no |
7171
| `ifconfig` | Makes the block's visibility dependent on a system configuration field. | XPath to the system configuration field. E.g. `contact/contact/enabled` | no |
@@ -90,7 +90,7 @@ We recommend always adding a `name` to containers. Otherwise, it is given a rand
9090

9191
| Attribute | Description | Values | Required? |
9292
|:------- |:------ |:------ |:------ |
93-
| `name` | A name that can be used to address the container in which this attribute is assigned. The name must be unique per generated page. If not specified, it will be autogenerated. | A-Z, a-z, 0-9, underscore (_), period (.), dash (-). Should start with a letter. Case-sensitive. | No |
93+
| `name` | A name that can be used to address the container in which this attribute is assigned. The name must be unique per generated page. If not specified, it will be auto-generated. | A-Z, a-z, 0-9, underscore (_), period (.), dash (-). Should start with a letter. Case-sensitive. | No |
9494
| `label` | Describes the purpose of the container. | Any | No |
9595
| `before` | Used to position the container before an element under the same parent. The element name or alias name is specified in the value. Use dash (-) to position the block before all other elements of its level of nesting. See [before and after attributes](#fedg_xml-instrux_before-after) for details. | Element name or dash (`-`) | No |
9696
| `after` | Used to position the container after an element under the same parent. The element name or alias name is specified in the value. Use dash (-) to position the block after all other elements of its level of nesting. See [before and after attributes](#fedg_xml-instrux_before-after) for details. | Element name or dash (-). | No |

src/guides/v2.3/frontend-dev-guide/layouts/xml-manage.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Blocks are created (declared) using the `<block>` instruction.
230230
Example: add a block with a product [SKU](https://glossary.magento.com/sku) information.
231231

232232
```xml
233-
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type">
233+
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="Magento_Catalog::product/view/attribute.phtml" after="product.info.type">
234234
<arguments>
235235
<argument name="at_call" xsi:type="string">getSku</argument>
236236
<argument name="at_code" xsi:type="string">sku</argument>
@@ -239,6 +239,9 @@ Example: add a block with a product [SKU](https://glossary.magento.com/sku) info
239239
</block>
240240
```
241241

242+
{:.bs-callout-info}
243+
Declare the `template` attribute with the name of the module it belongs to: `template="<VendorName>_<ModuleName>::path-to-template.phtml"`. Following this approach avoids failures with template rendering and makes it easier for the developer to find and navigate to the template file.
244+
242245
## Set body attributes {#layout_body_attributes}
243246

244247
To set attributes for the HTML `body` tag use the `<attribute>` instruction.

0 commit comments

Comments
 (0)