ElggMenuItem::getName PHP Method

getName() public method

Get the identifier of the menu item
public getName ( ) : string
return string
    public function getName()
    {
        return $this->data['name'];
    }

Usage Example

示例#1
0
 public function getMenuItem(ElggMenuItem $parent, $top_only = false)
 {
     if ($parent) {
         $menu_item = array('name' => "{$parent->getName()}:{$this->guid}", 'parent_name' => "{$parent->getName()}", 'text' => "<img class=\"hj-categories-tree-icon\" src=\"{$this->getIconURL('tiny')}\" width=\"12\" />" . $this->title . ' (' . $this->getFiledEntitiesCount() . ')', 'href' => $this->getURL(), 'class' => 'hj-categories-menu-child', 'priority' => $this->priority, 'data' => array('category_guid' => $this->guid));
     } else {
         $menu_item = array('name' => "{$this->guid}", 'text' => "<img class=\"hj-categories-tree-icon\" src=\"{$this->getIconURL('tiny')}\" width=\"12\" />" . $this->title . ' (' . $this->getFiledEntitiesCount() . ')', 'href' => $this->getURL(), 'class' => 'hj-categories-menu-root', 'priority' => $this->priority, 'data' => array('category_guid' => $this->guid));
     }
     $menu_item = ElggMenuItem::factory($menu_item);
     $return[] = $menu_item;
     // Empty menu item to create html markup
     if ($this->canEdit() && elgg_get_context() == 'category') {
         $add_new = array('name' => "{$menu_item->getName()}:addnew", 'parent_name' => "{$menu_item->getName()}", 'text' => '', 'item_class' => 'hidden', 'href' => false, 'priority' => 1);
         $return[] = ElggMenuItem::factory($add_new);
     }
     if (!$top_only) {
         $children = $this->getChildren();
         if (is_array($children)) {
             foreach ($children as $child) {
                 $submenu = $child->getMenuItem($menu_item);
                 if (is_array($submenu)) {
                     foreach ($submenu as $submenu_item) {
                         $return[] = $submenu_item;
                     }
                 }
             }
         }
     }
     return $return;
 }
All Usage Examples Of ElggMenuItem::getName