Skip to content

Commit

Permalink
Fix an issue with View renderer handling
Browse files Browse the repository at this point in the history
  • Loading branch information
teppokoivula committed Mar 3, 2020
1 parent 15f16f9 commit dfc6a66
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/RendererTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @property \ProcessWire\Module|null $renderer Renderer object.
*
* @version 0.1.0
* @version 0.1.1
* @author Teppo Koivula <[email protected]>
* @license Mozilla Public License v2.0 https://mozilla.org/MPL/2.0/
*/
Expand All @@ -20,7 +20,7 @@ trait RendererTrait {
*
* @var null|\ProcessWire\Module
*/
private $renderer;
private $renderer;

/**
* Set renderer
Expand All @@ -39,10 +39,10 @@ final public function setRenderer($renderer, array $settings = []): Wire {
}
if ($renderer instanceof \ProcessWire\Module) {
if ($needs_init) $renderer->init($settings);
$this->renderer = $renderer;
if (method_exists($this, 'setExt')) {
$this->setExt($renderer->getExt());
}
$this->renderer = $renderer;
if (method_exists($this, 'setExt')) {
$this->setExt($renderer->getExt());
}
}
return $this;
}
Expand All @@ -53,7 +53,7 @@ final public function setRenderer($renderer, array $settings = []): Wire {
* @return \ProcessWire\Module|null $renderer Wireframe renderer module or null.
*/
final public function getRenderer(): ?\ProcessWire\Module {
return $this->renderer ?: !$this instanceof View ? $this->wire('view')->getRenderer() : null;
return $this->renderer ?: (!$this instanceof View ? $this->wire('view')->getRenderer() : null);
}

}

0 comments on commit dfc6a66

Please sign in to comment.