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

#8106 Clarify JS init component key #8609

Merged

Conversation

DenisSaltanahmedov
Copy link
Contributor

Purpose of this pull request

This pull request adds additional examples of the "component key" related to JS data-mage-init to this topic.

Affected DevDocs pages

Links to Magento source code

  • src/guides/v2.4/javascript-dev-guide/javascript/js_init.md

Adding more information about component key in the Declarative notation section.
Copy link
Contributor

@BarnyShergold BarnyShergold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small correction

<nav data-mage-init='{"tooltip": {"content": "<?= /* @noEscape */ $content ?>"}}'></nav>
```

Or a custom JS component, can be component path `Vendor_Module/js/component` or alias declareted in `requirejs-config.js`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Or a custom JS component, can be component path `Vendor_Module/js/component` or alias declareted in `requirejs-config.js`.
Or a custom JS component, can be component path `Vendor_Module/js/component` or alias declared in `requirejs-config.js`.

@@ -111,6 +111,20 @@ On DOM ready, the `data-mage-init` attribute is parsed to extract component name
};
```

Where `<component_name>` native Magento JS component, for example: `menu`, `collapsible`, `tooltip` ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Where `<component_name>` native Magento JS component, for example: `menu`, `collapsible`, `tooltip` ...
Where `<component_name>` is a native Magento JS component, for example: `menu`, `collapsible`, `tooltip` ...

<nav data-mage-init='{"tooltip": {"content": "<?= /* @noEscape */ $content ?>"}}'></nav>
```

Or a custom JS component, can be component path `Vendor_Module/js/component` or alias declareted in `requirejs-config.js`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Or a custom JS component, can be component path `Vendor_Module/js/component` or alias declareted in `requirejs-config.js`.
Or a custom JS component, implemented with a component path: `Vendor_Module/js/component`, or as an alias declared in `requirejs-config.js`.

If this suggestion is not accurate, than some kind of grammar fix is needed here.

<nav data-mage-init='{"Vendor_Module/js/component": {"status":"<?= /* @noEscape */ $block->getStatus(); ?>"}}'></nav>
```

More about [locate JS components](https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_debug.html).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
More about [locate JS components](https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_debug.html).
Read more about [locate JS components](https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_debug.html).

@DenisSaltanahmedov
Copy link
Contributor Author

@BarnyShergold, @dobooth thanks for your help. I have fixed the review.

@dobooth
Copy link
Contributor

dobooth commented Feb 3, 2021

running tests

@dobooth dobooth added 2.3.x Magento 2.3 related changes 2.4.x Magento 2.4.x related changes Technical Updates to the code or processes that alter the technical content of the doc labels Feb 3, 2021
@dobooth dobooth enabled auto-merge February 3, 2021 18:29
@dobooth dobooth merged commit f6a7753 into magento:master Feb 3, 2021
@ghost
Copy link

ghost commented Feb 3, 2021

Hi @DenisSaltanahmedov, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2.3.x Magento 2.3 related changes 2.4.x Magento 2.4.x related changes Progress: done Technical Updates to the code or processes that alter the technical content of the doc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants