Skip to content

Commit

Permalink
Check Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- committed Feb 3, 2025
1 parent b7e6e8b commit b949103
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/template/elements/BaseElementVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function render(bool $editMode = false): string

// We only need the template_id for container content elements
if ($this->elementContent instanceof ContainerElement) {
$options['template_id'] = $this->elementContent->templateInstance?->template_id;
$options['template_id'] = TemplateInstance::getTypeById($this->elementContent->templateInstance->id);
}
} else {
$options = $this->options;
Expand Down
8 changes: 8 additions & 0 deletions modules/template/models/TemplateInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,12 @@ public function getType() {
return $this->container_item_id === null ? self::TYPE_PAGE : self::TYPE_CONTAINER;
}

public static function getTypeById($id): string
{
$instance = self::findOne($id);
if ($instance === null) {
return '';
}
return $instance->container_item_id === null ? 'page' : 'container';
}
}

0 comments on commit b949103

Please sign in to comment.