本文整理汇总了PHP中Illuminate\View\Factory::getFinder方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getFinder方法的具体用法?PHP Factory::getFinder怎么用?PHP Factory::getFinder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\Factory
的用法示例。
在下文中一共展示了Factory::getFinder方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* Compile the view at the given path.
*
* @param string $path
* @return void
*/
public function compile($path)
{
// View finder.
$finder = $this->view->getFinder();
// Get the list of view paths from the app.
$paths = $finder->getPaths();
// Get hints.
$hints = $finder->getHints();
// Get current theme uses.
$currentThemeUses = \Theme::getThemeNamespace();
if (isset($hints[$currentThemeUses])) {
$paths = array_merge($paths, $hints[$currentThemeUses]);
}
// Get the directory the requested view sits in.
$viewdir = dirname($path);
// Match it to a view path registered in config::view.paths
foreach ($paths as $dir) {
if (stristr($viewdir, $dir)) {
$path = str_replace($dir . '/', '', $path);
break;
}
}
// Create a loader for this template.
$loader = new Twig_Loader_Filesystem($paths);
// Instance compiler.
$twig = $this->getTwigCompiler($loader);
return $twig->render($path, $this->data);
}
示例2: __construct
public function __construct(Request $request, Factory $factory)
{
$this->request = $request;
$this->view_path = realpath(base_path('resources/views'));
$this->factory = $factory;
$this->finder = $factory->getFinder();
$this->finder->addExtension('schema.php');
}
示例3: __construct
public function __construct(Request $request, Factory $factory, array $data, $sources = [], $meta = [])
{
$this->request = $request;
$this->data = $data;
$this->sources = $sources;
$this->factory = $factory;
$this->finder = $factory->getFinder();
if ($meta) {
$this->data['jsonapi'] = array_filter($meta);
}
}
示例4: getNormalizedName
/**
* Get the normalized name, for creator/composer events
*
* @param \Illuminate\View\Factory $viewEnvironment
* @return string
*/
protected function getNormalizedName($viewEnvironment)
{
$paths = $viewEnvironment->getFinder()->getPaths();
$name = $this->getTemplateName();
// Replace absolute paths, trim slashes, remove extension
$name = str_replace($paths, '', $name);
$name = ltrim($name, '/');
if (substr($name, -5, 5) === '.twig') {
$name = substr($name, 0, -5);
}
return $name;
}
示例5: loadTheme
/**
* Load a theme
*
* @param string $theme
* @throws \Exception
*/
private function loadTheme($theme)
{
if (!isset($theme)) {
return;
}
$th = $this->findThemeByDirectory($theme);
if (isset($th)) {
$viewFinder = $this->view->getFinder();
$viewFinder->prependPath($th->getPath());
if (!is_null($th->getParent())) {
$this->loadTheme($th->getParent());
}
$this->activeTheme = $theme;
}
}
示例6: getSections
private function getSections($parent)
{
$sections = [];
if (!$this->view->exists($parent)) {
$this->warn("Could not find view: {$parent}");
return $sections;
}
$path = $this->view->getFinder()->find($parent);
$content = $this->file->get($path);
if (preg_match_all('/\\B@(\\w+)([ \\t]*)(\\( ( (?>[^()]+) | (?3) )* \\))?/x', $content, $matches)) {
for ($i = 0; $i < count($matches[1]); $i++) {
if ($matches[1][$i] == 'yield') {
$sections[] = $matches[4][$i];
}
}
}
return $sections;
}
示例7: getFinder
/**
* Get the view finder instance.
*
* @return \Illuminate\View\ViewFinderInterface
* @static
*/
public static function getFinder()
{
return \Illuminate\View\Factory::getFinder();
}
示例8: location
/**
* Find view location.
*
* @param boolean $realpath
* @return string
*/
public function location($realpath = false)
{
if ($this->view->exists($this->content)) {
return $realpath ? $this->view->getFinder()->find($this->content) : $this->content;
}
}
示例9: getViewHints
/**
* @return array
*/
public function getViewHints()
{
return $this->view->getFinder()->getHints();
}