public function __construct($name, $options = null, $_name = false)
{
$url = $this->getUrl($options);
$this->name = strtolower(preg_replace('/[^\\w\\d\\-\\_\\.]/s', "", $name));
$this->attributes = is_array($options) ? $this->extractAttr($options) : array();
if ($_name) {
$this->name = $_name;
}
if (is_array($options)) {
$linkAttr = $options['link_attr'];
$this->meta = $options['meta_attr'];
$this->name = $options['menu_name'] ? $options['menu_name'] : $this->name;
if ($options['sub_menu'] && is_array($options['sub_menu'])) {
while ($item = array_shift($options['sub_menu'])) {
$this->add($item);
}
}
}
// Create an object of type Link
$this->link = new MenuLink($name, $url, $linkAttr);
$this->id = ++self::$last_id;
}