? Pending

User tests: Successful: Unsuccessful:

avatar thednp
thednp
30 Sep 2020

Pull Request for Issue #30272.

Summary of Changes

As discussed in the #30272 report, Joomla does not support namespaced templates, this commit solves that.

  • 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.

Testing Instructions

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
<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

Actual result BEFORE applying this Pull Request

The namespacemap.php class had no support for Site Templates / Administrator Templates. addfieldpreffix couldn't be used with template defined custom fields.

Expected result AFTER applying this Pull Request

Site Templates / Administrator Templates can be developed with namespace features.

Documentation Changes Required

Yes. (I wish I knew where)

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?
avatar thednp thednp - open - 30 Sep 2020
avatar thednp thednp - change - 30 Sep 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Sep 2020
Category Libraries
avatar thednp thednp - change - 30 Sep 2020
The description was changed
avatar thednp thednp - edited - 30 Sep 2020
avatar thednp thednp - change - 30 Sep 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-09-30 12:37:20
Closed_By thednp
Labels Added: ?
avatar thednp thednp - close - 30 Sep 2020

Add a Comment

Login with GitHub to post a comment