Example #1
0
 /**
  * Method for adding a link to the menu
  * @param String $url - url that the link points to
  * @param String $title - title that appears
  * @param int $sort_order - order at which the link should appear in menu
  * @param array $attributes - html attributes for this link only.\
  * the global attributes specified by the instance variable will be overridden by this
  */
 public function add_link($url, $title, $sort_order = NULL, $attributes = array())
 {
     $args = func_get_args();
     $filter_pass = DynamicMenu_Filter::apply_filters('add_link', $args);
     if (!$filter_pass) {
         return $this;
     }
     $attributes = array_merge($this->attributes, $attributes);
     $anchor = Html::anchor($url, $title, $attributes);
     $key = self::slugify($title);
     $this->links[$key] = array('html' => $anchor, 'title' => $title, 'sort_order' => (int) $sort_order);
     return $this;
 }
Example #2
0
 public function __construct()
 {
     DynamicMenu_Filter::add(new Acl_Menu_Filter());
 }