magento / devdocs

[Deprecated] Magento Developer Documentation
Open Software License 3.0
674 stars 1.76k forks source link

Potentially invalid warning, and inaccurately states not used "options" of "field" node. #8165

Closed dfelton closed 3 months ago

dfelton commented 4 years ago

Topic clarification/correction request

Topic Link

https://devdocs.magento.com/guides/v2.4/config-guide/prod/config-reference-systemxml.html#field-node-reference

Description

However, I have found that if the field is of type="select", the options node works, and seems to be a rather nice approach for providing source options without having to build out a PHP class for it.

<field id="foo_bar" type="select" showInDefault="1">
    <label>Can We Use This?</label>
    <options>
        <option label="We can certainly use this">w00t</option>
        <option label="No do not use this">sad_face</option>
    </options>
</field>

The inner text of each option tag above gets populated into the value attribute of the select node's option tag on the page. And as one would suspect, the label attribute of the option tag gets populated into the inner text of the option tag on the page.

Possible solutions

If this is "potentially deprecated" as the description states, I'd like to see where in the source code it states this (I admit I haven't looked myself). At a minimum, the statement "these nodes are not reusable" (at the moment) is false in regards to options.

If this functionality is not deprecated, the following description may be appropriate:

Can be used to declare options where source_model is not defined. Is used to only when a given field has a type of select. This node expects option child node(s).

Additional information

I take no issue with writing out the usual PHP model that implements the appropriate interface. But also see value in providing developers the ability to configure options here if it is a feature that is going to stay. The current documentation is vague, "Potentially deprecated" seems rather meaningless to me. Something is either deprecated or it is not.

dshevtsov commented 3 months ago

The topic was migrated. If the issue is still relevant, please feel free to reopen it.