コード例 #1
0
 /**
  * Register new MenuItems, which is usefull for Sitemap and etc.
  */
 public function initMenuItems()
 {
     Event::listen('pages.menuitem.listTypes', function () {
         return ['location-town' => 'Location Town', 'all-location-towns' => 'All location towns'];
     });
     Event::listen('pages.menuitem.getTypeInfo', function ($type) {
         if ($type == 'location-town' || $type == 'all-location-towns') {
             return Town::getMenuTypeInfo($type);
         }
     });
     Event::listen('pages.menuitem.resolveItem', function ($type, $item, $url, $theme) {
         if ($type == 'location-town' || $type == 'all-location-towns') {
             return Town::resolveMenuItem($item, $url, $theme);
         }
     });
 }