From 97ea01b8393f86a5358b6eed0766dfac2445e0d9 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Fri, 24 Nov 2023 11:04:05 +0700 Subject: [PATCH 1/4] Optimized Override code --- .../library/astroid/Helper/Overrides.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/framework/library/astroid/Helper/Overrides.php b/framework/library/astroid/Helper/Overrides.php index 58eb7a0e..4e03f723 100644 --- a/framework/library/astroid/Helper/Overrides.php +++ b/framework/library/astroid/Helper/Overrides.php @@ -62,13 +62,7 @@ public static function getHTMLTemplate(): string { $backtrace = \debug_backtrace(); $callPath = $backtrace[0]['file'] ?? ''; - $template_name = ASTROID_TEMPLATE_NAME; - $isChildTemplate = Helper::isChildTemplate($template_name); - - if ($isChildTemplate && isset($isChildTemplate['isChild']) && $isChildTemplate['isChild']) { - $template_name = $isChildTemplate['parent']; - } - $htmlTemplatePath = JPATH_ROOT . '/templates/'.$template_name.'/html'; + $htmlTemplatePath = JPATH_ROOT . '/templates/'.ASTROID_TEMPLATE_NAME.'/html'; $htmlAstroidPath = JPATH_LIBRARIES . '/astroid/framework/html'; if (\strpos($callPath, $htmlTemplatePath) === 0) { @@ -76,7 +70,17 @@ public static function getHTMLTemplate(): string { } if (empty($relativePath)) { - return self::generateExtensionPath(\substr($callPath, stripos($callPath, '/html/') + 5)); + // Check if template is child-template and file is not exist then select html from parent + $isChildTemplate = Helper::isChildTemplate(ASTROID_TEMPLATE_NAME); + if ($isChildTemplate && isset($isChildTemplate['isChild']) && $isChildTemplate['isChild']) { + $htmlTemplatePath = JPATH_ROOT . '/templates/'.$isChildTemplate['parent'].'/html'; + } + if (\strpos($callPath, $htmlTemplatePath) === 0) { + $relativePath = \substr($callPath, \strlen($htmlTemplatePath)); + } + if (empty($relativePath)) { + return self::generateExtensionPath(\substr($callPath, stripos($callPath, '/html/') + 5)); + } } $astroidOverridePath = $htmlAstroidPath . $relativePath; From a1f1b8f66604732a627d26bb0e39398b7d95ef80 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Fri, 24 Nov 2023 16:17:09 +0700 Subject: [PATCH 2/4] Update style for Login, Article Related, Tags Popular --- assets/vendor/astroid/scss/joomla/_base.scss | 3 + framework/frontend/blog/modules/related.php | 14 +- framework/html/mod_login/card.php | 139 +++++++++++++++++++ framework/html/mod_login/default.php | 137 ++++++++++++++++++ framework/html/mod_tags_popular/default.php | 34 +++++ framework/html/mod_tags_popular/index.html | 9 ++ 6 files changed, 329 insertions(+), 7 deletions(-) create mode 100644 framework/html/mod_login/card.php create mode 100644 framework/html/mod_login/default.php create mode 100644 framework/html/mod_tags_popular/default.php create mode 100644 framework/html/mod_tags_popular/index.html diff --git a/assets/vendor/astroid/scss/joomla/_base.scss b/assets/vendor/astroid/scss/joomla/_base.scss index 44737d40..c861944e 100644 --- a/assets/vendor/astroid/scss/joomla/_base.scss +++ b/assets/vendor/astroid/scss/joomla/_base.scss @@ -19,4 +19,7 @@ ul.tags { --bs-btn-padding-y: 0.3rem; --bs-btn-padding-x: 1rem; } +} +.pagenavigation .pagination a { + padding: 5px 15px; } \ No newline at end of file diff --git a/framework/frontend/blog/modules/related.php b/framework/frontend/blog/modules/related.php index bb684942..c220013c 100644 --- a/framework/frontend/blog/modules/related.php +++ b/framework/frontend/blog/modules/related.php @@ -12,21 +12,21 @@ use Joomla\CMS\Language\Text; // No direct access. defined('_JEXEC') or die; -jimport('astroid.framework.article'); extract($displayData); if (empty($items)) { return; } +$document = Astroid\Framework::getDocument(); ?>