mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-29 18:55:53 -04:00
25 lines
623 B
PHP
25 lines
623 B
PHP
<?php
|
|
|
|
use CodeIgniter\Events\Events;
|
|
|
|
if (!function_exists('pluginContent')) {
|
|
function pluginContent(string $section, array $data = []): string
|
|
{
|
|
$results = Events::trigger("view:{$section}", $data);
|
|
|
|
if (is_array($results)) {
|
|
return implode('', array_filter($results, fn ($r) => is_string($r)));
|
|
}
|
|
|
|
return is_string($results) ? $results : '';
|
|
}
|
|
}
|
|
|
|
if (!function_exists('pluginContentExists')) {
|
|
function pluginContentExists(string $section): bool
|
|
{
|
|
$observers = Events::listRegistered("view:{$section}");
|
|
return !empty($observers);
|
|
}
|
|
}
|