3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
6 * Translatable objects trait
10 * Copyright © 2020-2023 The Galette Team
12 * This file is part of Galette (http://galette.tuxfamily.org).
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2020-2023 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
37 namespace Galette\Core
;
39 use DI\Attribute\Inject
;
42 * Plugin controllers trait
45 * @name PluginControllerTrait
47 * @author Johan Cwiklinski <johan@x-tnd.be>
48 * @copyright 2020-2023 The Galette Team
49 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
50 * @link http://galette.tuxfamily.org
54 trait PluginControllerTrait
58 * #[Inject("Plugin Galette Name")]
61 protected $module_info;
64 * Get plugin module ID
68 protected function getModuleId()
70 return $this->module_info
['module_id'];
74 * Get plugin module route namespace
77 protected function getModuleRoute()
79 return $this->module_info
['module']['route'];
83 * Get plugin template name for Twig
85 * @param $name Template name
89 protected function getTemplate($name): string
91 return sprintf('@%s/%s.html.twig', $this->plugins
->getClassName($this->getModuleId()), $name);