{"action":"created","issue":{"url":"https://api.github.com/repos/Elgg/Elgg/issues/8819","labels_url":"https://api.github.com/repos/Elgg/Elgg/issues/8819/labels{/name}","comments_url":"https://api.github.com/repos/Elgg/Elgg/issues/8819/comments","events_url":"https://api.github.com/repos/Elgg/Elgg/issues/8819/events","html_url":"https://github.com/Elgg/Elgg/issues/8819","id":99525027,"number":8819,"title":"Arbitrary data in ElggMenuItem::factory()","user":{"login":"hypeJunction","id":1202761,"avatar_url":"https://avatars.githubusercontent.com/u/1202761?v=3","gravatar_id":"","url":"https://api.github.com/users/hypeJunction","html_url":"https://github.com/hypeJunction","followers_url":"https://api.github.com/users/hypeJunction/followers","following_url":"https://api.github.com/users/hypeJunction/following{/other_user}","gists_url":"https://api.github.com/users/hypeJunction/gists{/gist_id}","starred_url":"https://api.github.com/users/hypeJunction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypeJunction/subscriptions","organizations_url":"https://api.github.com/users/hypeJunction/orgs","repos_url":"https://api.github.com/users/hypeJunction/repos","events_url":"https://api.github.com/users/hypeJunction/events{/privacy}","received_events_url":"https://api.github.com/users/hypeJunction/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-06T21:08:18Z","updated_at":"2015-08-07T10:12:07Z","closed_at":"2015-08-07T05:56:48Z","body":"When passing arbitrary parameters to the factory, they do not get added to the item ```data```, but show up as attributes on the menu link:\r\n\r\n```php\r\n    $item = ElggMenuItem::factory(array(\r\n\t\t\t\t'name' => 'dashboard',\r\n\t\t\t\t'text' => elgg_echo('dashboard'),\r\n\t\t\t\t'icon' => 'dashboard',\r\n\t\t\t\t'indicator' => 25,\r\n\t\t\t\t'href' => \"$user->username/dashboard\",\r\n\t\t\t\t'priority' => 100,\r\n\t\t\t\t'section' => 'management',\r\n\t));\r\n```\r\n\r\nrendered into (while ```$item->getData('icon')``` is `null`)\r\n\r\n```html\r\n<li class=\"elgg-menu-item-dashboard\"><a href=\"http://xxx.dev/ismayil.khayredinov/dashboard\" icon=\"dashboard\" indicator=\"25\" class=\"elgg-menu-content\"><span class=\"elgg-non-link\">Dashboard</span></a></li>\r\n```\r\n\r\nThis works, as expected:\r\n\r\n```php\r\n\t$item = ElggMenuItem::factory(array(\r\n\t\t\t\t'name' => 'dashboard',\r\n\t\t\t\t'text' => elgg_echo('dashboard'),\r\n\t\t\t\t'data' => array(\r\n\t\t\t\t\t'icon' => 'dashboard',\r\n\t\t\t\t\t'indicator' => 25,\r\n\t\t\t\t),\r\n\t\t\t\t'href' => \"$user->username/dashboard\",\r\n\t\t\t\t'priority' => 100,\r\n\t\t\t\t'section' => 'management',\r\n\t));\r\n```"},"comment":{"url":"https://api.github.com/repos/Elgg/Elgg/issues/comments/128664489","html_url":"https://github.com/Elgg/Elgg/issues/8819#issuecomment-128664489","issue_url":"https://api.github.com/repos/Elgg/Elgg/issues/8819","id":128664489,"user":{"login":"ewinslow","id":356564,"avatar_url":"https://avatars.githubusercontent.com/u/356564?v=3","gravatar_id":"","url":"https://api.github.com/users/ewinslow","html_url":"https://github.com/ewinslow","followers_url":"https://api.github.com/users/ewinslow/followers","following_url":"https://api.github.com/users/ewinslow/following{/other_user}","gists_url":"https://api.github.com/users/ewinslow/gists{/gist_id}","starred_url":"https://api.github.com/users/ewinslow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewinslow/subscriptions","organizations_url":"https://api.github.com/users/ewinslow/orgs","repos_url":"https://api.github.com/users/ewinslow/repos","events_url":"https://api.github.com/users/ewinslow/events{/privacy}","received_events_url":"https://api.github.com/users/ewinslow/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T10:12:07Z","updated_at":"2015-08-07T10:12:07Z","body":"Hmm... I see your point. This is a confusing case because there's one set of arguments but two elements where they could potentially go. So some arguments are special-cased and the others just have some default behavior of defining attributes on one of those elements. I guess we chose the <a> tag at some point... I'd be ok with switching to outputting those extra params on the `<li>` tag, but then we'd have to break BC, which it's too late for 2.0 to do, and possibly not worth the hassle at all..."}}