Skip to content

Commit

Permalink
Merge pull request #466 from templaza/v3
Browse files Browse the repository at this point in the history
Fix issue call override files from child-template
  • Loading branch information
sonvnn authored Nov 23, 2023
2 parents 10119c2 + 8206f1d commit 7d56eb4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion framework/library/astroid/Helper/Overrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

namespace Astroid\Helper;
use Astroid\Helper;
use Joomla\Filesystem\Folder;

defined('_JEXEC') or die;
Expand Down Expand Up @@ -60,7 +61,14 @@ private static function generateExtensionPath(string $path) : string {
public static function getHTMLTemplate(): string {
$backtrace = \debug_backtrace();
$callPath = $backtrace[0]['file'] ?? '';
$htmlTemplatePath = JPATH_ROOT . '/templates/'.ASTROID_TEMPLATE_NAME.'/html';

$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';
$htmlAstroidPath = JPATH_LIBRARIES . '/astroid/framework/html';

if (\strpos($callPath, $htmlTemplatePath) === 0) {
Expand Down

0 comments on commit 7d56eb4

Please sign in to comment.