Skip to content

Allow to define section frontend model in system configuration #1600

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

Merged
merged 2 commits into from
Mar 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/code/Magento/Config/etc/system.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<xs:element name="header_css" type="xs:string" />
<xs:element name="resource" type="typeAclResourceId" />
<xs:element ref="group" />
<xs:element name="frontend_model" type="typeModel" />
Copy link
Contributor

Choose a reason for hiding this comment

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

the attribute group for this element is defined on line 55, would it make more sense to put it there?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess no. It will add the attribute for <group> node.
But I've added new element/node inside <section> node. It is used in this function
\Magento\Config\Block\System\Config\Edit::_prepareLayout()

protected function _prepareLayout()
{
/** @var $section \Magento\Config\Model\Config\Structure\Element\Section */
$section = $this->_configStructure->getElement($this->getRequest()->getParam('section'));
$this->_formBlockName = $section->getFrontendModel();
if (empty($this->_formBlockName)) {
$this->_formBlockName = self::DEFAULT_SECTION_BLOCK;
}
...
}
And the node allows to use custom block for section rendering.

</xs:choice>
</xs:sequence>
<xs:attributeGroup ref="elementsAttributeGroup"/>
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Config/etc/system_file.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<xs:element name="resource" type="typeAclResourceId" />
<xs:element ref="group" />
<xs:element name="include" type="includeType"/>
<xs:element name="frontend_model" type="typeModel" />
</xs:choice>
</xs:sequence>

Expand Down