Skip to content

Commit

Permalink
Added method to detect base template as string
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed Oct 9, 2017
1 parent a81ff27 commit 7513038
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Components/BaseComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,18 @@ public function renderSelf($layout = null, $title = null)
*/
public function renderContent($layout = null, $title = null)
{
if ($this->getTemplate() != self::class) {
if (!$this->isBaseTemplate()) {
return parent::renderSelf($layout, $title);
}
}

/**
* Answers true if the receiver uses the base template.
*
* @return boolean
*/
public function isBaseTemplate()
{
return (is_string($this->getTemplate()) && $this->getTemplate() === self::class);
}
}

0 comments on commit 7513038

Please sign in to comment.