Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.xml comment model not allowed by the validation schema #770

Closed
tzyganu opened this issue Nov 25, 2014 · 4 comments
Closed

System.xml comment model not allowed by the validation schema #770

tzyganu opened this issue Nov 25, 2014 · 4 comments
Assignees
Labels
improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@tzyganu
Copy link
Contributor

tzyganu commented Nov 25, 2014

I'm trying to add a dynamic comment on a system.xml file.
In magento 1 this was possible by adding this on the field definion

<comment>
    <model>[module]/field_comment</model><!-- this made it dynamic -->
</comment>

and creating the model class [Namespace]_[Module]_Model_Field_Comment that contains a public method getCommentText.
In Magento 2 this is not possible anymore because of the validation schema Magento/Backend/etc/system_file.xsd. In this schema the comment node has the type type="xs:string".
The odd think is that in the code that generates the form the case of a comment model is handled
Magento\Backend\Model\Config\Structure\Element\Field::getComment looks like this:

public function getComment($currentValue = '')
{
    $comment = '';
    if (isset($this->_data['comment'])) {
        if (is_array($this->_data['comment'])) {
            if (isset($this->_data['comment']['model'])) {
                $model = $this->_commentFactory->create($this->_data['comment']['model']);
                $comment = $model->getCommentText($currentValue);
            }
        } else {
            $comment = parent::getComment();
        }
    }
    return $comment;
}

So I guess you can bring back this functionality just by changing the type of the comment node.
Please bring it back. Even if it doesn't sound like much, I've used this a few times to present important messages for the admins directly in the configuration area.

@verklov
Copy link
Contributor

verklov commented Dec 1, 2014

@tzyganu, thank you for your request! We will consider the change you requested and will get back to you once we have a response.

@vpelipenko
Copy link
Contributor

Internal ticket: MAGETWO-31251

@vpelipenko vpelipenko added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development PROD and removed TECH labels Feb 20, 2015
@ilol ilol added TECH and removed PROD labels Mar 2, 2015
@tzyganu
Copy link
Contributor Author

tzyganu commented Mar 16, 2016

I see that this was merged in the develop branch. Thanks. I will close the issue.

@tzyganu tzyganu closed this as completed Mar 16, 2016
@sunilit42
Copy link
Contributor

is there any way to create field programically?

i want to add each payment one fee text box.

mmansoor-magento pushed a commit that referenced this issue Jan 26, 2017
…l4_test

MAGETWO-63018: L4 Magento\UrlRewrite\Block\Catalog\Edit\FormTest::testGetEntityStores test failed
fe-lix- pushed a commit to fe-lix-/magento2 that referenced this issue Apr 6, 2018
MSI-633: Investigate possible exception with $this->getProductIdsBySkus->execute([$sku])[$sku]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

7 participants