. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Menu; use Fisharebest\Webtrees\Tree; /** * Trait ModuleMenuTrait - default implementation of ModuleMenuInterface */ trait ModuleMenuTrait { // The default position for this menu. It can be changed in the control panel. protected int $menu_order; /** * Users change change the order of menus using the control panel. * * @param int $menu_order * * @return void */ public function setMenuOrder(int $menu_order): void { $this->menu_order = $menu_order; } /** * Users change change the order of menus using the control panel. * * @return int */ public function getMenuOrder(): int { return $this->menu_order ?? $this->defaultMenuOrder(); } /** * The default position for this menu. * * @return int */ public function defaultMenuOrder(): int { return 9999; } /** * A menu, to be added to the main application menu. * * @param Tree $tree * * @return Menu|null */ public function getMenu(Tree $tree): Menu|null { return null; } }