diff --git a/administrator/components/com_templates/Extension/TemplatesComponent.php b/administrator/components/com_templates/Extension/TemplatesComponent.php new file mode 100644 index 0000000000000..3095e34d0bf30 --- /dev/null +++ b/administrator/components/com_templates/Extension/TemplatesComponent.php @@ -0,0 +1,46 @@ +getRegistry()->register('templates', new Templates); + } +} diff --git a/administrator/components/com_templates/helpers/html/templates.php b/administrator/components/com_templates/Service/HTML/Templates.php similarity index 59% rename from administrator/components/com_templates/helpers/html/templates.php rename to administrator/components/com_templates/Service/HTML/Templates.php index f3db2c3c9a866..3f5bf0924418b 100644 --- a/administrator/components/com_templates/helpers/html/templates.php +++ b/administrator/components/com_templates/Service/HTML/Templates.php @@ -7,16 +7,21 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Templates\Administrator\Service\HTML; + defined('_JEXEC') or die; use Joomla\CMS\Application\ApplicationHelper; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Uri\Uri; /** - * JHtml helper class. + * Html helper class. * * @since 1.6 */ -class JHtmlTemplates +class Templates { /** * Display the thumb for the template. @@ -28,7 +33,7 @@ class JHtmlTemplates * * @since 1.6 */ - public static function thumb($template, $clientId = 0) + public function thumb($template, $clientId = 0) { $client = ApplicationHelper::getClientInfo($clientId); $basePath = $client->path . '/templates/' . $template; @@ -40,12 +45,12 @@ public static function thumb($template, $clientId = 0) { $clientPath = ($clientId == 0) ? '' : 'administrator/'; $thumb = $clientPath . 'templates/' . $template . '/template_thumbnail.png'; - $html = JHtml::_('image', $thumb, JText::_('COM_TEMPLATES_PREVIEW')); + $html = HTMLHelper::_('image', $thumb, Text::_('COM_TEMPLATES_PREVIEW')); if (file_exists($preview)) { $html = '' . $html . ''; + HTMLHelper::_('tooltipText', 'COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . ''; } } @@ -62,35 +67,32 @@ public static function thumb($template, $clientId = 0) * * @since 3.4 */ - public static function thumbModal($template, $clientId = 0) + public function thumbModal($template, $clientId = 0) { $client = ApplicationHelper::getClientInfo($clientId); $basePath = $client->path . '/templates/' . $template; - $baseUrl = ($clientId == 0) ? JUri::root(true) : JUri::root(true) . '/administrator'; + $baseUrl = ($clientId == 0) ? Uri::root(true) : Uri::root(true) . '/administrator'; $thumb = $basePath . '/template_thumbnail.png'; $preview = $basePath . '/template_preview.png'; $html = ''; - if (file_exists($thumb)) + if (file_exists($thumb) && file_exists($preview)) { - if (file_exists($preview)) - { - $preview = $baseUrl . '/templates/' . $template . '/template_preview.png'; - $footer = ''; + $preview = $baseUrl . '/templates/' . $template . '/template_preview.png'; + $footer = ''; - $html .= JHtml::_( - 'bootstrap.renderModal', - $template . '-Modal', - array( - 'title' => JText::_('COM_TEMPLATES_BUTTON_PREVIEW'), - 'height' => '500px', - 'width' => '800px', - 'footer' => $footer, - ), - $body = '