Skip to content

Commit

Permalink
feat: improve getTemplate (use ::tpl fallback)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed May 16, 2023
1 parent 27b5b25 commit b6f6d14
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion RockMigrations.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,14 @@ public function getUser($name, $quiet = false)
public function getTemplate($name, $quiet = false)
{
if ($name instanceof RockPageBuilderBlock) return $name->getTpl();
if ($name instanceof Page) $name = $name->template;
if ($name instanceof Page) {
if (!$name->template) {
try {
$name = $name::tpl;
} catch (\Throwable $th) {
}
} else $name = $name->template;
}
$template = $this->templates->get((string)$name);
if ($template and $template->id) return $template;
if (!$quiet) $this->log("Template $name not found");
Expand Down

0 comments on commit b6f6d14

Please sign in to comment.