mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-16 04:57:46 +02:00
refactor(view-components): use CI4's View Decorators to render components
This commit is contained in:
parent
a182d96f18
commit
a3ebd6c9a4
6 changed files with 42 additions and 181 deletions
|
|
@ -7,13 +7,10 @@ namespace Config;
|
|||
use App\Libraries\Breadcrumb;
|
||||
use App\Libraries\Negotiate;
|
||||
use App\Libraries\Router;
|
||||
use App\Libraries\View;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use CodeIgniter\HTTP\Request;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\Router\RouteCollectionInterface;
|
||||
use Config\Services as AppServices;
|
||||
use Config\View as ViewConfig;
|
||||
|
||||
/**
|
||||
* Services Configuration file.
|
||||
|
|
@ -48,24 +45,6 @@ class Services extends BaseService
|
|||
return new Router($routes, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Renderer class is the class that actually displays a file to the user. The default View class within
|
||||
* CodeIgniter is intentionally simple, but this service could easily be replaced by a template engine if the user
|
||||
* needed to.
|
||||
*/
|
||||
public static function renderer(?string $viewPath = null, ?ViewConfig $config = null, bool $getShared = true): View
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance('renderer', $viewPath, $config);
|
||||
}
|
||||
|
||||
$viewPath = $viewPath ?: config('Paths')
|
||||
->viewDirectory;
|
||||
$config = $config ?? config('View');
|
||||
|
||||
return new View($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger());
|
||||
}
|
||||
|
||||
/**
|
||||
* The Negotiate class provides the content negotiation features for working the request to determine correct
|
||||
* language, encoding, charset, and more.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue