/** * Register a new menu link * @param $data * @param array $params * @param string $ref * @return array * @throws \Exception */ public static function registerMenu($data = ['name' => null, 'link' => null, 'type' => 'module', 'ico' => 'fa-pencil'], $params = ['position' => null], $ref = 'arxmin::menu') { $params = Arr::mergeWithDefaultParams($params); $menu = Hook::get($ref); if ($params['position'] !== null) { Arr::insert($menu, [$data], $params['position']); } else { $menu[] = $data; } Hook::set($ref, $menu); return Hook::get($ref); }
public function testHook() { Hook::register('test'); Hook::add('test', 'test'); $this->assertNotNull(Hook::get('test'), 'Hook is null !'); }