FEATURE #1427: add homepage functionality.
Displaying homepage now depends on module handler
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use Symfony\Component\Process\Exception\InvalidArgumentException;
|
||||
|
||||
class Template
|
||||
{
|
||||
/**
|
||||
* Getter for real template name
|
||||
*
|
||||
* @param $template
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public static function name($template)
|
||||
{
|
||||
|
||||
$namespace = null;
|
||||
if (strpos($template, '::')) {
|
||||
list($namespace, $template) = explode('::', $template);
|
||||
}
|
||||
|
||||
$theme = config('app.theme');
|
||||
|
||||
// list of prefixes
|
||||
$prefixes = [$theme . '.custom.', $theme . '.', ''];
|
||||
|
||||
$view = null;
|
||||
foreach ($prefixes as $prefix) {
|
||||
if (view()->exists($namespace . 'visitor.' . $prefix . $template)) {
|
||||
$view = $namespace . 'visitor.' . $prefix . $template;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_null($view)) {
|
||||
throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template);
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user