|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2020 |
|
6
|
|
|
* @package Client |
|
7
|
|
|
* @subpackage Html |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
namespace Aimeos\Client\Html\Catalog\Price; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Default implementation of catalog price HTML client |
|
16
|
|
|
* |
|
17
|
|
|
* @package Client |
|
18
|
|
|
* @subpackage Html |
|
19
|
|
|
*/ |
|
20
|
|
|
class Standard |
|
21
|
|
|
extends \Aimeos\Client\Html\Catalog\Filter\Standard |
|
22
|
|
|
implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
23
|
|
|
{ |
|
24
|
|
|
/** client/html/catalog/price/standard/subparts |
|
25
|
|
|
* List of HTML sub-clients rendered within the catalog price section |
|
26
|
|
|
* |
|
27
|
|
|
* The output of the frontend is composed of the code generated by the HTML |
|
28
|
|
|
* clients. Each HTML client can consist of serveral (or none) sub-clients |
|
29
|
|
|
* that are responsible for rendering certain sub-parts of the output. The |
|
30
|
|
|
* sub-clients can contain HTML clients themselves and therefore a |
|
31
|
|
|
* hierarchical tree of HTML clients is composed. Each HTML client creates |
|
32
|
|
|
* the output that is placed inside the container of its parent. |
|
33
|
|
|
* |
|
34
|
|
|
* At first, always the HTML code generated by the parent is printed, then |
|
35
|
|
|
* the HTML code of its sub-clients. The order of the HTML sub-clients |
|
36
|
|
|
* determines the order of the output of these sub-clients inside the parent |
|
37
|
|
|
* container. If the configured list of clients is |
|
38
|
|
|
* |
|
39
|
|
|
* array( "subclient1", "subclient2" ) |
|
40
|
|
|
* |
|
41
|
|
|
* you can easily change the order of the output by reordering the subparts: |
|
42
|
|
|
* |
|
43
|
|
|
* client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
44
|
|
|
* |
|
45
|
|
|
* You can also remove one or more parts if they shouldn't be rendered: |
|
46
|
|
|
* |
|
47
|
|
|
* client/html/<clients>/subparts = array( "subclient1" ) |
|
48
|
|
|
* |
|
49
|
|
|
* As the clients only generates structural HTML, the layout defined via CSS |
|
50
|
|
|
* should support adding, removing or reordering content by a fluid like |
|
51
|
|
|
* design. |
|
52
|
|
|
* |
|
53
|
|
|
* @param array List of sub-client names |
|
54
|
|
|
* @since 2018.04 |
|
55
|
|
|
* @category Developer |
|
56
|
|
|
*/ |
|
57
|
|
|
private $subPartPath = 'client/html/catalog/price/standard/subparts'; |
|
58
|
|
|
private $subPartNames = ['price']; |
|
59
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Returns the sub-client given by its name. |
|
63
|
|
|
* |
|
64
|
|
|
* @param string $type Name of the client type |
|
65
|
|
|
* @param string|null $name Name of the sub-client (Default if null) |
|
66
|
|
|
* @return \Aimeos\Client\Html\Iface Sub-client object |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getSubClient( string $type, string $name = null ) : \Aimeos\Client\Html\Iface |
|
69
|
|
|
{ |
|
70
|
|
|
/** client/html/catalog/price/decorators/excludes |
|
71
|
|
|
* Excludes decorators added by the "common" option from the catalog filter price html client |
|
72
|
|
|
* |
|
73
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
74
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
75
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
76
|
|
|
* modify what is returned to the caller. |
|
77
|
|
|
* |
|
78
|
|
|
* This option allows you to remove a decorator added via |
|
79
|
|
|
* "client/html/common/decorators/default" before they are wrapped |
|
80
|
|
|
* around the html client. |
|
81
|
|
|
* |
|
82
|
|
|
* client/html/catalog/price/decorators/excludes = array( 'decorator1' ) |
|
83
|
|
|
* |
|
84
|
|
|
* This would remove the decorator named "decorator1" from the list of |
|
85
|
|
|
* common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
86
|
|
|
* "client/html/common/decorators/default" to the html client. |
|
87
|
|
|
* |
|
88
|
|
|
* @param array List of decorator names |
|
89
|
|
|
* @since 2018.04 |
|
90
|
|
|
* @category Developer |
|
91
|
|
|
* @see client/html/common/decorators/default |
|
92
|
|
|
* @see client/html/catalog/price/decorators/global |
|
93
|
|
|
* @see client/html/catalog/price/decorators/local |
|
94
|
|
|
*/ |
|
95
|
|
|
|
|
96
|
|
|
/** client/html/catalog/price/decorators/global |
|
97
|
|
|
* Adds a list of globally available decorators only to the catalog filter price html client |
|
98
|
|
|
* |
|
99
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
100
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
101
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
102
|
|
|
* modify what is returned to the caller. |
|
103
|
|
|
* |
|
104
|
|
|
* This option allows you to wrap global decorators |
|
105
|
|
|
* ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
106
|
|
|
* |
|
107
|
|
|
* client/html/catalog/price/decorators/global = array( 'decorator1' ) |
|
108
|
|
|
* |
|
109
|
|
|
* This would add the decorator named "decorator1" defined by |
|
110
|
|
|
* "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
111
|
|
|
* |
|
112
|
|
|
* @param array List of decorator names |
|
113
|
|
|
* @since 2018.04 |
|
114
|
|
|
* @category Developer |
|
115
|
|
|
* @see client/html/common/decorators/default |
|
116
|
|
|
* @see client/html/catalog/price/decorators/excludes |
|
117
|
|
|
* @see client/html/catalog/price/decorators/local |
|
118
|
|
|
*/ |
|
119
|
|
|
|
|
120
|
|
|
/** client/html/catalog/price/decorators/local |
|
121
|
|
|
* Adds a list of local decorators only to the catalog filter price html client |
|
122
|
|
|
* |
|
123
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
124
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
125
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
126
|
|
|
* modify what is returned to the caller. |
|
127
|
|
|
* |
|
128
|
|
|
* This option allows you to wrap local decorators |
|
129
|
|
|
* ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
130
|
|
|
* |
|
131
|
|
|
* client/html/catalog/price/decorators/local = array( 'decorator2' ) |
|
132
|
|
|
* |
|
133
|
|
|
* This would add the decorator named "decorator2" defined by |
|
134
|
|
|
* "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
135
|
|
|
* |
|
136
|
|
|
* @param array List of decorator names |
|
137
|
|
|
* @since 2018.04 |
|
138
|
|
|
* @category Developer |
|
139
|
|
|
* @see client/html/common/decorators/default |
|
140
|
|
|
* @see client/html/catalog/price/decorators/excludes |
|
141
|
|
|
* @see client/html/catalog/price/decorators/global |
|
142
|
|
|
*/ |
|
143
|
|
|
|
|
144
|
|
|
return parent::getSubClient( $type, $name ); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* Returns the names of the subpart clients |
|
150
|
|
|
* |
|
151
|
|
|
* @return array List of client names |
|
152
|
|
|
*/ |
|
153
|
|
|
protected function getSubClientNames() : array |
|
154
|
|
|
{ |
|
155
|
|
|
return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
156
|
|
|
} |
|
157
|
|
|
} |
|
158
|
|
|
|