Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 public function testHook()
 {
     Hook::register('test');
     Hook::add('test', 'test');
     $this->assertNotNull(Hook::get('test'), 'Hook is null !');
 }