This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Form component container #6871
Merged
dobooth
merged 15 commits into
magento:master
from
Jehangir-Wahid:form-component-container
Mar 19, 2020
Merged
Form component container #6871
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a63b66b
Adding documentation for the UI-Component Container
Jehangir-Wahid 565d5ac
Changing text type from Boolean to String in the options' configurati…
Jehangir-Wahid 41d4932
Refining an issue recommended by Markdown Linting Test
Jehangir-Wahid 87352cf
Removing all of the trailing spaces
Jehangir-Wahid 03260d1
Merge branch 'master' into form-component-container
Jehangir-Wahid 1ae556d
Resolving Fenced code blocks issue
Jehangir-Wahid 8655816
Merge branch 'form-component-container' of github.com:Jehangir-Wahid/…
Jehangir-Wahid 03b1407
Modifying the document as suggested
Jehangir-Wahid cd4a932
Merge branch 'master' into form-component-container
Jehangir-Wahid a47d7b4
Grammar and formatting
dobooth 5eea859
Merge branch 'master' into form-component-container
dobooth d1d952e
Added **Source files** section
Jehangir-Wahid 1e5f46f
Added link to component page
Jehangir-Wahid 8e77e26
Added Component configuration option
Jehangir-Wahid 588881a
Merge branch 'master' into form-component-container
dobooth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions
105
src/guides/v2.3/ui_comp_guide/components/ui-container.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
group: ui-components-guide | ||
title: Container component | ||
--- | ||
|
||
The Container [UI component](https://glossary.magento.com/ui-component) can be used for wrapping particular fields or other ui-components in it with some description text. It can also be used without any field but just to display a notice or description of a fieldset. | ||
|
||
## Configuration options | ||
|
||
Component's options are set in the UI-component's configuration `.xml` file as follows: | ||
|
||
```xml | ||
<container name="%name%"> | ||
<argument name="data" xsi:type="array"> | ||
<item name="config" xsi:type="array"> | ||
<!-- Configurable options are specified here --> | ||
<item name="template" xsi:type="%type%">%value%</item> | ||
<item name="sortOrder" xsi:type="%type%">%value%</item> | ||
<item name="label" xsi:type="%type%">%value%</item> | ||
<item name="additionalClasses" xsi:type="%type%">%value%</item> | ||
<item name="text" xsi:type="%type%" translate="%boolean%">%value%</item> | ||
</item> | ||
</argument> | ||
</container> | ||
``` | ||
|
||
| Option | Description | Type | Default | | ||
| --- | --- | --- | --- | | ||
| `template` | Path to the component's `.html` template. | String | `ui/form/components/complex` | | ||
| `sortOrder` | Description for the Container. | Number | `0` | | ||
Jehangir-Wahid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| `label` | Label displayed for the Container. | String | `''` | | ||
| `additionalClasses` | CSS class(es) applied to the root node of the component's `.html` template. | String | `''` | | ||
| `text` | Description for the Container. | String | `''` | | ||
|
||
## Examples | ||
|
||
### Container with a component | ||
|
||
The following sample is an example of the Container component contain a `Select` component. | ||
|
||
```xml | ||
<container name="container_name"> | ||
<argument name="data" xsi:type="array"> | ||
<item name="config" xsi:type="array"> | ||
<item name="template" xsi:type="string">ui/form/components/complex</item> | ||
<item name="sortOrder" xsi:type="number">10</item> | ||
<item name="label" xsi:type="string">Container Label</item> | ||
<item name="additionalClasses" xsi:type="string">sample-additional-class</item> | ||
<item name="text" xsi:type="string" translate="true"><![CDATA[ | ||
<p> | ||
Container Text. | ||
</p> | ||
]]></item> | ||
</item> | ||
</argument> | ||
<field name="sort_direction" | ||
sortOrder="20" | ||
formElement="select"> | ||
<settings> | ||
<dataType>text</dataType> | ||
<label translate="true">Sort Direction</label> | ||
<dataScope>data.sort_direction</dataScope> | ||
</settings> | ||
<formElements> | ||
<select> | ||
<settings> | ||
<options class="Vendor\Module\Model\Source\Config\SortDirection" /> | ||
<caption translate="true">-- Please Select --</caption> | ||
</settings> | ||
</select> | ||
</formElements> | ||
</field> | ||
</container> | ||
``` | ||
#### Result | ||
|
||
 | ||
|
||
### Container without any fields | ||
|
||
The following sample is an example of the Container component only. | ||
|
||
```xml | ||
<container name="container_name"> | ||
<argument name="data" xsi:type="array"> | ||
<item name="config" xsi:type="array"> | ||
<item name="template" xsi:type="string">ui/form/components/complex</item> | ||
<item name="sortOrder" xsi:type="number">10</item> | ||
<item name="label" xsi:type="string">Container Label</item> | ||
<item name="additionalClasses" xsi:type="string">sample-additional-class</item> | ||
<item name="text" xsi:type="string" translate="true"><![CDATA[ | ||
<p> | ||
Change these settings if you do not want to apply the global display configurations. | ||
</p> | ||
]]></item> | ||
</item> | ||
</argument> | ||
</container> | ||
``` | ||
|
||
#### Result | ||
|
||
The `text` of this container is styled using the `additionalClasses` value, i.e. `sample-additional-class`. | ||
|
||
 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.