2021-08-18 19:42:30 +00:00
|
|
|
<?php
|
2023-10-21 09:45:02 +00:00
|
|
|
|
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-10-21 09:45:02 +00:00
|
|
|
use Dotclear\App;
|
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-10-21 09:45:02 +00:00
|
|
|
/**
|
|
|
|
* @brief translater backend class.
|
|
|
|
* @ingroup translater
|
|
|
|
*
|
|
|
|
* @author Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
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
|
2021-09-24 23:58:59 +00:00
|
|
|
{
|
2023-07-29 12:54:35 +00:00
|
|
|
return self::status(My::checkContext(My::BACKEND));
|
2021-09-24 23:58:59 +00:00
|
|
|
}
|
|
|
|
|
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-10-21 09:45:02 +00:00
|
|
|
App::behavior()->addBehaviors([
|
|
|
|
'adminModulesListGetActions' => BackendBehaviors::adminModulesGetActions(...),
|
|
|
|
'adminModulesListDoActions' => BackendBehaviors::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
|
|
|
]);
|
|
|
|
},
|
|
|
|
]);
|
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
|
|
|
}
|