Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As discussed in the #30272 report, Joomla does not support namespaced templates, this commit solves that. **Changes** * the `create()` method now checks for namespaced `template` extension types * the `getNamespaces()` method properly recognize *Administrator* and *Site* templates; in addition, it will look for `templateDetails.xml` file instead of `extensionName.xml` and read the designated namespace (Line 182) **Other change** * replaced `defined('_JEXEC') or die;` with `defined('JPATH_PLATFORM') or die;`, perhaps this change was also expected? Either way, it was my best guess. **Test setup - also a good piece of documentation draft** In order to enable namespace for templates, here are the few steps, we'll use the default site template: * open `site/templates/cassiopeia/templateDetails.xml` and add between `<description>` and `<files>` the following ```markup <namespace path="src">Joomla\Template\Cassiopeia</namespace> ``` * delete `site/administrator/cache/autoload_psr4.php` * login to your `site/administrator` * open the newly created `site/administrator/cache/autoload_psr4.php`, the last element of the return object should be ``` 'Joomla\\Template\\Cassiopeia\\Site\\' => [JPATH_SITE . '/templates/cassiopeia/src'] ``` * *optional*: create a custom field in `site/templates/cassiopeia/src/Field` folder and add it to the `templateDetails.xml` along with `addfieldprefix="Joomla\Template\Cassiopeia\Site\Field"` attribute added to the parent `<fieldset>` * *optional* try and call the newly added custom field from your namespaced template into a module/plugin, test it out **Questions** * should I commit this change to the `4.1-dev` branch as well? * should I commit this change to the `staging` branch? If yes, where is the `namespacemap.php` file?
- Loading branch information