File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ## 1.0.5 - 2023-06-08
2+ ### Changed
3+ - ` atoms ` config option now supports an array of paths
4+
15## 1.0.4 - 2020-02-15
26### Fixed
37- Fix error when using nested atom name (` / ` ) in closing tag
Original file line number Diff line number Diff line change 11{
22 "name" : " ether/atom" ,
33 "description" : " Adding enhanced modularity to Craft CMS Twig templating" ,
4- "version" : " 1.0.4 " ,
4+ "version" : " 1.0.5 " ,
55 "type" : " craft-plugin" ,
66 "license" : " MIT" ,
77 "minimum-stability" : " dev" ,
Original file line number Diff line number Diff line change @@ -53,21 +53,25 @@ public static function renderAtom (
5353 ) : void {
5454 $ view = Craft::$ app ->getView ();
5555
56- $ template = self ::$ _config ['atoms ' ] . '/ ' . $ handle ;
56+ $ atomPaths = self ::$ _config ['atoms ' ];
57+ if (!is_array ($ atomPaths )) $ atomPaths = [$ atomPaths ];
5758
5859 $ variables ['children ' ] = new Markup ($ children , 'utf8 ' );
5960
60- if (! $ view -> doesTemplateExist ( $ template ) )
61+ foreach ( $ atomPaths as $ path )
6162 {
62- Craft::error (
63- "Error locating template: {$ template }" ,
64- __METHOD__
65- );
63+ $ template = $ path . '/ ' . $ handle ;
6664
67- return ;
65+ if ($ view ->doesTemplateExist ($ template )) {
66+ echo $ view ->renderTemplate ($ template , $ variables );
67+ return ;
68+ }
6869 }
6970
70- echo $ view ->renderTemplate ($ template , $ variables );
71+ Craft::error (
72+ "Error locating template: {$ handle }" ,
73+ __METHOD__
74+ );
7175 }
7276
7377}
Original file line number Diff line number Diff line change 77 * _Defaults to `_atoms`_
88 *
99 * The location of your atoms, relative to your `templates` directory.
10+ * Can also be an array of paths, in descending order of priority.
1011 */
1112 'atoms ' => '_atoms ' ,
1213];
You can’t perform that action at this time.
0 commit comments