We have moved to Github. Please open tickets there.

Opened 2 years ago

Last modified 11 months ago

#3545 new Enhancement

Index $items in menu by menu item name

Reported by: ewinslow Owned by:
Priority: normal Milestone: Elgg 1.9.0
Component: Core Version: 1.8 Beta
Severity: minor Keywords:
Cc: brett@… Difficulty: moderate

Description

I'd like an easy way to change a particular menu item, but right now I have to loop through all the items and manually check the name. Being able to just do $items[$name]->setProperty() would be so much nicer.

Change History (5)

comment:1 Changed 2 years ago by cash

  • Difficulty changed from easy to moderate

Two options:

  • using array_combine() to replace the integer indexes with the names
  • writing container class that allows access by name

I think the 2nd one is cleaner but much more effort.

comment:2 Changed 2 years ago by ewinslow

By container class you mean something like ElggMenu and pass that to the gook rather than an array of items? $menu->getItem('name')->setProperty() would be how it would work to target a particular item?

comment:3 Changed 2 years ago by cash

Yes, but you can make it work like $menuname?->setProperty()

comment:4 Changed 23 months ago by ewinslow

  • Milestone changed from Needs Review to Elgg 1.9

comment:5 Changed 11 months ago by cash

  • Milestone changed from Near Term Future Release to Elgg 1.9.0
Note: See TracTickets for help on using tickets.