mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-02 22:36:21 -04:00
- Consolidate duplicate documentation sections - Move Internationalization section after Plugin Views - Remove redundant Example Plugin Structure and View Hooks sections - Fix PSR-12 brace style in plugin_helper.php - Fix PSR-12 brace style in PluginInterface.php (remove unnecessary PHPdocs) - Fix PSR-12 brace style in BasePlugin.php (remove unnecessary PHPdocs) - Use log_message() instead of error_log() in migration - Add IF NOT EXISTS to plugin_config table creation for resilience - Convert snake_case to camelCase for class names throughout docs
24 lines
643 B
PHP
24 lines
643 B
PHP
<?php
|
|
|
|
use CodeIgniter\Events\Events;
|
|
|
|
if (!function_exists('plugin_content')) {
|
|
function plugin_content(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('plugin_content_exists')) {
|
|
function plugin_content_exists(string $section): bool
|
|
{
|
|
$observers = Events::listRegistered("view:{$section}");
|
|
return !empty($observers);
|
|
}
|
|
} |