diff --git a/src/Infrastructure/View/TemplatedView.php b/src/Infrastructure/View/TemplatedView.php index 06e61c7..d9c7193 100644 --- a/src/Infrastructure/View/TemplatedView.php +++ b/src/Infrastructure/View/TemplatedView.php @@ -50,6 +50,10 @@ public function __construct( * @return self Modified templated view. */ public function set_locations( array $locations ): self { + if ( empty( $locations ) ) { + $locations = $this->get_default_locations(); + } + $this->locations = array_map( function ( $location ) { return $this->ensure_trailing_slash( $location ); }, $locations ); @@ -111,15 +115,15 @@ private function get_locations( string $path ): array { } /** - * Set the default locations for the templated view. + * Get the default locations for the templated view. * - * @return self Modified templated view. + * @return array Array of default locations. */ - private function set_default_locations(): self { - return $this->set_locations( [ + private function get_default_locations(): array { + return [ STYLESHEETPATH, TEMPLATEPATH, \dirname( __DIR__, 2 ), - ] ); + ]; } }