translater/src/Backend.php

53 lines
1.3 KiB
PHP
Raw Normal View History

2021-08-18 19:42:30 +00:00
<?php
2021-09-02 21:44:01 +00:00
/**
* @brief translater, a plugin for Dotclear 2
2021-11-01 21:32:32 +00:00
*
2021-09-02 21:44:01 +00:00
* @package Dotclear
* @subpackage Plugin
2021-11-01 21:32:32 +00:00
*
2021-09-02 21:44:01 +00:00
* @author Jean-Christian Denis & contributors
2021-11-01 21:32:32 +00:00
*
2021-09-02 21:44:01 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2023-03-14 23:26:31 +00:00
declare(strict_types=1);
2022-12-03 16:10:38 +00:00
2023-03-14 23:26:31 +00:00
namespace Dotclear\Plugin\translater;
2021-08-18 19:42:30 +00:00
2023-03-14 23:26:31 +00:00
use dcCore;
2023-07-29 12:54:35 +00:00
use Dotclear\Core\Process;
use Dotclear\Core\Backend\Favorites;
2021-08-18 19:42:30 +00:00
2023-07-29 12:54:35 +00:00
class Backend extends Process
2021-08-18 19:42:30 +00:00
{
2023-03-14 23:26:31 +00:00
public static function init(): bool
{
2023-07-29 12:54:35 +00:00
return self::status(My::checkContext(My::BACKEND));
}
2023-03-14 23:26:31 +00:00
public static function process(): bool
2021-08-18 22:48:47 +00:00
{
2023-07-29 12:54:35 +00:00
if (!self::status()) {
2023-03-14 23:26:31 +00:00
return false;
2021-08-18 22:48:47 +00:00
}
2021-09-02 21:44:01 +00:00
2023-07-29 12:54:35 +00:00
My::addBackendMenuItem();
2023-03-14 23:26:31 +00:00
dcCore::app()->addBehaviors([
'adminModulesListGetActions' => [BackendBehaviors::class, 'adminModulesGetActions'],
'adminModulesListDoActions' => [BackendBehaviors::class, 'adminModulesDoActions'],
2023-07-29 12:54:35 +00:00
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
2023-03-14 23:26:31 +00:00
$favs->register(My::id(), [
'title' => My::name(),
2023-07-29 12:54:35 +00:00
'url' => My::manageUrl(),
'small-icon' => My::icons(),
'large-icon' => My::icons(),
2023-03-14 23:26:31 +00:00
//'permissions' => null,
]);
},
]);
2021-09-02 21:44:01 +00:00
2023-03-14 23:26:31 +00:00
return true;
2021-08-18 22:48:47 +00:00
}
2021-11-01 21:32:32 +00:00
}