library/Helper/Template.php
public static function locateTemplate($template, $additionalPaths = array())
    {
        $defaultPaths = array(
            get_stylesheet_directory() . '/views',
            get_stylesheet_directory(),
            get_template_directory() . '/views',
            get_template_directory()
        );

        $searchPaths = array_merge($defaultPaths, $additionalPaths);

        $searchPaths = apply_filters('Municipio/blade/view_paths', $searchPaths);

        if (isset($searchPaths) && is_array($searchPaths) && !empty($searchPaths)) {
            foreach ($searchPaths as $path) {
                $file = $path . '/' . str_replace('.blade.php', '', basename($template)) . '.blade.php';

                if (!file_exists($file)) {
                    continue;
                }

                return $file;
            }
        } else {
            error_log("Muncipio error: No template search paths defined in " . __DIR__ . __FILE__);
        }

        return false;
    }
public static function locateTemplate($template, $additionalPaths = array())
    {
        $defaultPaths = array(
            get_stylesheet_directory() . '/views',
            get_stylesheet_directory(),
            get_template_directory() . '/views',
            get_template_directory()
        );

        $searchPaths = array_merge($defaultPaths, $additionalPaths);

        $searchPaths = apply_filters('Municipio/blade/view_paths', $searchPaths);

        if (isset($searchPaths) && is_array($searchPaths) && !empty($searchPaths)) {
            foreach ($searchPaths as $path) {
                $file = $path . '/' . str_replace('.blade.php', '', basename($template)) . '.blade.php';

                if (!file_exists($file)) {
                    continue;
                }

                return $file;
            }
        } else {
            error_log("Muncipio error: No template search paths defined in " . __DIR__ . __FILE__);
        }

        return false;
    }
public static function locateTemplate ( $ template , $ additionalPaths = array ( ) ) { $ defaultPaths = array ( get_stylesheet_directory ( ) . '/views' , get_stylesheet_directory ( ) , get_template_directory ( ) . '/views' , get_template_directory ( ) ) ; $ searchPaths = array_merge ( $ defaultPaths , $ additionalPaths ) ; $ searchPaths = apply_filters ( 'Municipio/blade/view_paths' , $ searchPaths ) ; if ( isset ( $ searchPaths ) && is_array ( $ searchPaths ) && ! empty ( $ searchPaths ) ) { foreach ( $ searchPaths as $ path ) { $ file = $ path . '/' . str_replace ( '.blade.php' , '' , basename ( $ template ) ) . '.blade.php' ; if ( ! file_exists ( $ file ) ) { continue ; } return $ file ; } } else { error_log ( "Muncipio error: No template search paths defined in " . __DIR__ . __FILE__ ) ; } return false ; }
Check if and where template exists
@param  string $template        Template file name
@param  array  $additionalPaths Additional search paths
@return bool                    False if not found else path to template file
Check if and where template exists