. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; /** * Trait ModuleMenuTrait - default implementation of ModuleMenuInterface */ trait ModuleMenuTrait { /** @var int The default position for this menu. It can be changed in the control panel. */ protected $menu_order = 0; /** * 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; } }