Files
FOSSBilling/src/modules/Widgets/Controller/Admin.php
T
Yağızhan Burak YakarandAdam Daley 19120d5a19 Introducing widgets (#2853)
* Add "widgets" to the list of core modules

* Patch 44 for widget support

* +Widgets module

* Basic widget discovery

* +Render logic

* +render_widget_slot Twig function

* +get_list

* +Basic settings page to list active widgets

* +Add an `enabled` column to toggle the widget

* +disconnectUnavailable

* Catch exceptions while rendering templates and display an error block

* Types, checks and stuff

* +Add widgets/batch_connect to the crons

Also removed the 11+ year old "finish fixing, time to sleep" docblock

* Demonstration: Replace hardcoded branding text with a widget

* Changed the directory structure

* +Add an error block for the admin panel

* +Added the `widgets` table

* Actually this is pretty unnecessary.

* "render_widget_slot" -> "render_widgets"

* Updated the dates

* Also inject admin/client API if accessible

* +Add an options column

* Implemented optional "add_br" toggle

* Log the exception

* Redid the widgets module

* Added a few new slots

* If even the error template fails, there are bigger problems. Just display the error instead of catching it.

* Created and implemented WidgetProviderInterface

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-02-05 04:16:33 +00:00

54 lines
1.2 KiB
PHP

<?php
/**
* Copyright 2022-2025 FOSSBilling
* SPDX-License-Identifier: Apache-2.0.
*
* @copyright FOSSBilling (https://www.fossbilling.org)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
*/
namespace Box\Mod\Widgets\Controller;
class Admin implements \FOSSBilling\InjectionAwareInterface
{
protected ?\Pimple\Container $di = null;
public function setDi(\Pimple\Container $di): void
{
$this->di = $di;
}
public function getDi(): ?\Pimple\Container
{
return $this->di;
}
public function fetchNavigation(): array
{
return [
'subpages' => [
[
'location' => 'extensions',
'label' => __trans('Widgets'),
'index' => 500,
'uri' => $this->di['url']->adminLink('widgets'),
'class' => '',
],
],
];
}
public function register(\Box_App &$app): void
{
$app->get('/widgets', 'get_index', [], static::class);
}
public function get_index(\Box_App $app): string
{
$this->di['is_admin_logged'];
return $app->render('mod_widgets_index');
}
}