. * * @category Core * @package Galette * * @author Johan Cwiklinski * @copyright 2020-2022 The Galette Team * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version * @link http://galette.tuxfamily.org * @since 2020-12-09 */ namespace Galette\Core; use Analog\Analog; /** * Plugin controllers trait * * @category Entity * @name PluginControllerTrait * @package Galette * @author Johan Cwiklinski * @copyright 2020-2022 The Galette Team * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version * @link http://galette.tuxfamily.org * @since 2020-12-09 */ trait PluginControllerTrait { /** * Something like: * Inject("Plugin Galette Name") * @var integer */ protected $module_info; /** * Get plugin module ID * * @return string */ protected function getModuleId() { return $this->module_info['module_id']; } /** * Get plugin module route namespace * @return string */ protected function getModuleRoute() { return $this->module_info['module']['route']; } /** * Get plugin template name for Twig * * @param $name Template name * * @return string */ protected function getTemplate($name): string { return sprintf('@%s/%s.html.twig', $this->plugins->getClassName($this->getModuleId()), $name); } }