Skip to content

Commit

Permalink
Corrects underpin autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstandiford committed May 11, 2021
1 parent 9e7402f commit 0ffd9ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/traits/Templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ protected function get_template_arg_defaults() {
*
* @param $template_name string The template name to get.
* @param $params array of param values that can be used in the template via get_param().
*
* @return string The template contents.
*/
public function get_template( $template_name, array $params = [] ) {
Expand Down Expand Up @@ -166,6 +167,7 @@ public function get_depth() {
*
* @param mixed $param The param to load.
* @param mixed $default (optional) The default value of the param, if it does not exist.
*
* @return mixed The parameter value, if it exists. Otherwise, this will use the default value.
*/
public function get_param( $param, $default = false ) {
Expand Down Expand Up @@ -213,6 +215,7 @@ protected function get_template_directory() {
* @since 1.0.0
*
* @param string $template_name The template to use.
*
* @return string The template visibility.
*/
private function get_template_visibility( $template_name ) {
Expand All @@ -233,6 +236,7 @@ private function get_template_visibility( $template_name ) {
* @since 1.0.0
*
* @param $template_name string the template name to include.
*
* @return string The complete template path.
*/
protected function get_template_path( $template_name ) {
Expand All @@ -248,6 +252,7 @@ protected function get_template_path( $template_name ) {
* @since 1.0.0
*
* @param $template_name string The template name to locate.
*
* @return string The path to the located template.
*/
protected function locate_template( $template_name ) {
Expand All @@ -258,7 +263,7 @@ protected function locate_template( $template_name ) {
}

$template_group = trailingslashit( $this->get_template_group() );
$override_path = $this->get_override_dir() . $template_group;
$override_path = trailingslashit( $this->get_override_dir() ) . $template_group;
$override_file_path = trailingslashit( $override_path ) . $template_name . '.php';

// Check to see if we have a template override from another plugin
Expand Down Expand Up @@ -348,6 +353,7 @@ private function get_template_arg( $template_name, $arg ) {
* @since 1.0.0
*
* @param $template_name string The template name to check.
*
* @return bool True if the template is valid, false otherwise.
*/
public function is_valid_template( $template_name ) {
Expand All @@ -362,6 +368,7 @@ public function is_valid_template( $template_name ) {
* @since 1.0.0
*
* @param $template_name string The template name to check.
*
* @return bool True if the template file exists, false otherwise.
*/
public function template_file_exists( $template_name ) {
Expand All @@ -375,6 +382,7 @@ public function template_file_exists( $template_name ) {
*
* @param string $template_name The template name.
* @param array $params The params to use in the template.
*
* @return false|string The template contents if the file exists, false otherwise.
*/
private function include_template( $template_name, $params ) {
Expand Down Expand Up @@ -435,6 +443,7 @@ private function include_template( $template_name, $params ) {

return $result;
}

}

/**
Expand All @@ -444,6 +453,7 @@ private function include_template( $template_name, $params ) {
*
* @param $file string The file to include
* @param $scope array The scope items keyed by their variable name.
*
* @return bool True if include was successful, false otherwise.
*/
function underpin_include_file_with_scope( $file, $scope ) {
Expand Down
4 changes: 4 additions & 0 deletions lib/traits/Underpin_Templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ protected function get_template_root_path() {
return underpin()->template_dir();
}

protected function get_override_dir() {
return 'underpin/';
}

}

0 comments on commit 0ffd9ff

Please sign in to comment.