-
Notifications
You must be signed in to change notification settings - Fork 1.7k
#3361 New Configuration Type Topic #6539
#3361 New Configuration Type Topic #6539
Conversation
An admin must run tests on this PR before it can be merged. |
1 similar comment
An admin must run tests on this PR before it can be merged. |
@rogyar
Apologies for the mess with branches and PRs, It turned out that my previous PR was extremely out of date, that is how I managed to create an exact copy of the existing guide :) I believe I have solved the issue by creating everything from scratch.
There is already a reference to the config config-create.html
I am working on a custom config myself, as soon as I have it working I will be able to provide an example for a developer who wants to verify that a custom configuration is present in the merged config. |
Hi @rogyar based on my findings while working on a custom config I have recreated the whole page with what I believe is a more mean-full and straight forward explanation of how to extend and create custom configuration files. Could you please review my changes? |
Hi @diazwatson. Awesome, thank you for the update. And for providing the reference |
cdcb4c7
to
fca989b
Compare
Hey BOT why you assign this PR to me? 🤔 |
@jcalcaben @rogyar guys is there any other way you see this topic can be improved? |
If other modules have a `search.xml` file, they are merged with your file when it loads. | ||
|
||
To create a new configuration type, extend the `\Magento\Framework\Config\ReaderInterface`, which is [Magento\Framework\Config\Reader\Filesystem]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Config/Reader/Filesystem.php) to provide the following parameters: | ||
4. Define a reader by extending [Magento\Framework\Config\Reader\Filesystem]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/Config/Reader/Filesystem.php) class to provide the following parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @diazwatson. The only doubtful point that is left is why we have removed the description of all parameters accepted by the ReaderInterface
? below. We are still referencing these params here (above)
to provide the following parameters:
But then goes an example and no parameter description anymore.
And thank you for providing the detailed info!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rogyar, thanks for taking the time to review this.
I removed that intentionally because I think the original text is misleading and a bit confusing.
For instance, it used to say
developers should extend an interface
but we all know an interface should be implemented no extended.
Then it said that developers should provide
all these parameters
but in reality if all we need is to create a custom file and we are going to extend\Magento\Framework\Config\Reader\Filesystem
(rather than implement the interface) we only need to rewrite the protected attribute$_idAttributes
to map the nodes in the xml file.
As a proof, we can see the Reader in the core used as an example:
Model/Order/Pdf/Config/Reader.php
In this reader, only $_idAttributes
has been modified to provide a mapping for the xml file nodes.
In this PR I am still mentioning the Interface for those who want to create their own version of the reader.
I have change the paragraphs a bit trying to make this more clear.
Please let me know what you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense. Thank you
Our bots can be aggressive sometimes... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a technical perspective, I'm approving this one. Thank you @diazwatson for providing such extended information.
Thank you guys for your help with this @rogyar @dobooth @atwixfirster |
running tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple link errors. `
- internally linking to /guides/v2.3/guides/v2.3/config-guide/config/config-files.html#config-files-load-merge-merge, which does not exist
- _site/guides/v2.3/config-guide/config/config-create.html (line 430)
a href="/guides/v2.3/guides/v2.3/config-guide/config/config-files.html#config-files-load-merge-merge">Configuration file merge
- _site/guides/v2.3/config-guide/config/config-create.html (line 430)
- linking to internal hash #config-files-load-merge-merge that does not exist
- _site/guides/v2.3/config-guide/config/config-create.html (line 430)
a href="/guides/v2.3/guides/v2.3/config-guide/config/config-files.html#config-files-load-merge-merge">Configuration file merge`
- _site/guides/v2.3/config-guide/config/config-create.html (line 430)
Working on it... |
Done Is there a way to run these tests locally to detect these issues in advance? |
Sure. In a CLI, at the devdocs root, run |
running tests |
Hi @diazwatson, thank you for your contribution! |
Purpose of this pull request
#3361 This pull request (PR) adds a new topic / section to explain how to use the classes described in Overview of module configuration files.
Affected DevDocs pages
Links to Magento source code
whatsnew
Added an 'Example of use' section to Create or extend configuration types.