Configuration
Configuration options for WPZylos Views.
Service Provider
The ViewServiceProvider registers view components.
Container Bindings
| Binding | Class | Description |
|---|---|---|
ViewFactory::class | ViewFactory | View factory |
'view' | ViewFactory | Alias |
Views Path
Default: {plugin_dir}/resources/views/
Custom path:
View::setPath('/custom/path/to/views');
File Extension
Default: .php
For Twig: .twig
Twig Options
When using Twig:
View::setTwigOptions([
'cache' => WP_CONTENT_DIR . '/cache/twig',
'debug' => WP_DEBUG,
'auto_reload' => true,
]);
Global Variables
Share variables across all views:
View::share('siteName', get_bloginfo('name'));
View::share('currentUser', wp_get_current_user());