Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
✨ added experimental view features
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed May 24, 2021
1 parent bb20ef0 commit 875505b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 36 deletions.
18 changes: 0 additions & 18 deletions Config/aloe.php

This file was deleted.

6 changes: 3 additions & 3 deletions Config/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ function plural($value, $count = 2)
if (!function_exists('render')) {
function render(string $view, array $data = [])
{
if (viewConfig("view_engine") === \Leaf\Blade::class) {
return markup(view($view, $data));
}
if (!viewConfig("experimental")) {
return markup(view($view, $data));
}

return viewConfig("render")($view, $data);
}
Expand Down
23 changes: 8 additions & 15 deletions Config/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,26 @@

/*
|--------------------------------------------------------------------------
| Template Engine [EXPERIMENTAL]
| Leaf EXPERIMENTAL features
|--------------------------------------------------------------------------
|
| Leaf MVC unlike other frameworks tries to give you as much control as
| you need. As such, you can decide which view engine to use.
| This allows you to use the experimental features below
|
*/
"view_engine" => \Leaf\Blade::class,
"experimental" => false,

/*
|--------------------------------------------------------------------------
| Custom render method [EXPERIMENTAL]
|--------------------------------------------------------------------------
|
| This render method is triggered whenever render() is called
| in your app if you're using a custom view engine.
| This render method is triggered whenever render() with the experimental
| option above set to true. This render method allows you to even plug
| in external view libraries, configure them and call them with `render`
| whenever and wherever you feel the need.
|
*/
"render" => function(string $view, array $data = []) {
$veins = new \Leaf\Veins\Template;
$veins->configure([
"veins_dir" => views_path(null, false),
"cache_dir" => storage_path('framework/views/'),
]);
$veins->set($data);
$veins->render($view);

// This example is what veins would look like
return markup(view($view, $data));
},
];

0 comments on commit 875505b

Please sign in to comment.