mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-05 08:52:00 +00:00

- replace some helper components and forms with class components in the ui - create viewcomponents service and load the component function to be used in views
29 lines
782 B
PHP
29 lines
782 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @copyright 2020 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
if (! function_exists('component')) {
|
|
/**
|
|
* Loads the specified class or view file component in the parameters
|
|
*
|
|
* @param array<string, array<string, mixed>> $properties
|
|
* @param array<string, array<string, mixed>> $attributes
|
|
*/
|
|
function component(string $name, array $properties = [], array $attributes = []): string
|
|
{
|
|
$componentLoader = service('viewcomponents');
|
|
|
|
$componentLoader->name = $name;
|
|
$componentLoader->properties = $properties;
|
|
$componentLoader->attributes = $attributes;
|
|
|
|
return $componentLoader->load();
|
|
}
|
|
}
|