Skip to content

Commit 38dad30

Browse files
committed
MAGETWO-34177: Simplification of Payment Configuration
- CR
1 parent 05c1035 commit 38dad30

File tree

4 files changed

+102
-11
lines changed

4 files changed

+102
-11
lines changed

app/code/Magento/Config/etc/system_file.xsd

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@
66
*/
77
-->
88
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
9-
<xs:element name="config">
10-
<xs:complexType>
11-
<xs:sequence>
12-
<xs:element ref="system" minOccurs="1" maxOccurs="1" />
13-
</xs:sequence>
14-
</xs:complexType>
15-
</xs:element>
9+
<xs:element name="config" type="configDeclaration"/>
10+
11+
<xs:complexType name="configDeclaration">
12+
<xs:sequence>
13+
<xs:element ref="system" minOccurs="1" maxOccurs="1" />
14+
</xs:sequence>
15+
</xs:complexType>
1616

1717
<xs:element name="system">
1818
<xs:complexType>
1919
<xs:sequence>
2020
<xs:choice minOccurs="0" maxOccurs="unbounded">
2121
<xs:element ref="tab" />
22-
<xs:element ref="section"/>
22+
<xs:element ref="section" />
23+
<xs:element ref="include" />
2324
</xs:choice>
2425
</xs:sequence>
2526
</xs:complexType>
@@ -64,6 +65,18 @@
6465
<xs:attribute name="extends" type="xs:string" use="optional" />
6566
</xs:attributeGroup>
6667

68+
<xs:element name="include">
69+
<xs:annotation>
70+
<xs:documentation>
71+
Include Resource. Recursive complex type
72+
</xs:documentation>
73+
</xs:annotation>
74+
75+
<xs:complexType>
76+
<xs:attribute name="path" type="typePath" use="required" />
77+
</xs:complexType>
78+
</xs:element>
79+
6780
<xs:element name="tab">
6881
<xs:annotation>
6982
<xs:documentation>
@@ -95,6 +108,7 @@
95108
<xs:element name="header_css" type="xs:string" />
96109
<xs:element name="resource" type="typeAclResourceId" />
97110
<xs:element ref="group" />
111+
<xs:element ref="include" />
98112
</xs:choice>
99113
</xs:sequence>
100114

@@ -136,6 +150,7 @@
136150
<xs:element ref="group" minOccurs="0" maxOccurs="unbounded"/>
137151
<xs:element ref="depends" />
138152
<xs:element ref="attribute" />
153+
<xs:element ref="include" />
139154
</xs:choice>
140155
</xs:sequence>
141156

@@ -420,6 +435,19 @@
420435
</xs:restriction>
421436
</xs:simpleType>
422437

438+
<xs:simpleType name="typePath">
439+
<xs:annotation>
440+
<xs:documentation>
441+
Path identifier. Item can has only [a-zA-Z0-9/_(inlove). Minimal length 8 symbol. Case sensitive.
442+
</xs:documentation>
443+
</xs:annotation>
444+
445+
<xs:restriction base="xs:string">
446+
<xs:pattern value="[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9/.]{1,}" />
447+
<xs:minLength value="8" />
448+
</xs:restriction>
449+
</xs:simpleType>
450+
423451
<xs:simpleType name="typeModule">
424452
<xs:annotation>
425453
<xs:documentation>

lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Compiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ public function __construct(
7676
* The compilation of the template and filling in the data
7777
*
7878
* @param \DOMNode $node
79-
* @param Object $processedObject
79+
* @param Object $processedObject
8080
* @param Object $context
8181
* @return void
8282
*/
83-
public function compile(\DOMNode $node, Object $processedObject, Object $context)
83+
public function compile(\DOMNode $node, Object $processedObject, Object $context)
8484
{
8585
switch ($node->nodeType) {
8686
case XML_TEXT_NODE:

lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/CompilerFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Framework\View\TemplateEngine\Xhtml;
77

8+
use Magento\Framework\Phrase;
89
use Magento\Framework\ObjectManagerInterface;
910
use Magento\Framework\Exception\LocalizedException;
1011

@@ -51,7 +52,7 @@ public function create(array $arguments = [])
5152
$object = $this->objectManager->create($this->instanceName, $arguments);
5253

5354
if (!($object instanceof CompilerInterface)) {
54-
throw new LocalizedException(__('This class must implement the "CompilerInterface"'));
55+
throw new LocalizedException(new Phrase('This class must implement the "CompilerInterface"'));
5556
}
5657

5758
return $object;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\View\TemplateEngine\Xhtml;
7+
8+
use Magento\Framework\Phrase;
9+
use Magento\Framework\ObjectManagerInterface;
10+
use Magento\Framework\Exception\LocalizedException;
11+
12+
/**
13+
* Class TemplateFactory
14+
*/
15+
class TemplateFactory
16+
{
17+
/**
18+
* Object manager
19+
*
20+
* @var ObjectManagerInterface
21+
*/
22+
protected $objectManager;
23+
24+
/**
25+
* Instance name
26+
*
27+
* @var string
28+
*/
29+
protected $instanceName;
30+
31+
/**
32+
* Constructor
33+
*
34+
* @param ObjectManagerInterface $objectManager
35+
* @param string $instanceName
36+
*/
37+
public function __construct(
38+
ObjectManagerInterface $objectManager,
39+
$instanceName = 'Magento\Framework\View\TemplateEngine\Xhtml\Template'
40+
) {
41+
$this->objectManager = $objectManager;
42+
$this->instanceName = $instanceName;
43+
}
44+
45+
/**
46+
* Create result
47+
*
48+
* @param array $arguments
49+
* @return Template
50+
* @throws LocalizedException
51+
*/
52+
public function create(array $arguments = [])
53+
{
54+
$object = $this->objectManager->create($this->instanceName, $arguments);
55+
56+
if (!($object instanceof Template)) {
57+
throw new LocalizedException(new Phrase('This class must inherit from a class "Template"'));
58+
}
59+
60+
return $object;
61+
}
62+
}

0 commit comments

Comments
 (0)