User talk:IagoQnsi/addptlinks

Easier Code, but no location, no index, control
addPortletLink('p-personal', 'http://link', 'label', 'id', 'tooltip'); While the code is easier to read, it's lacking functionality.

Specifically, there's no index control:

Does/should id be unique?
What exactly is the id? Seems to work even when it's not unique.

Best Practice
Is best practice to add multiple lines for multiple links?

The following appears to be valid, though poorly written: addPortletLink('p-personal', 'http://google.com', 'google', '22', 'tooltip'); addPortletLink('p-personal', 'http://yahoo.com', 'yahoo', '11', 'tooltip'); addPortletLink('p-personal', 'http://foo-bar.com', 'foo-bar', '22', 'tooltip'); addPortletLink('p-personal', 'http://foo', 'foo', '-5', 'tooltip link to foo'); addPortletLink('p-personal', 'user:foo/foo', 'user:foo/foo', 'id', 'tooltip link to user:foo/foo'); addPortletLink('p-personal', 'http://bar', 'bar', 'id', 'tooltip link to bar'); addPortletLink('p-personal', 'http://foo-bar', 'foo-bar', 'id', 'tooltip...'); --CmdrDan (talk) 03:37, 25 May 2014 (UTC)

Reply from IagoQnsi
Oops, I'm just seeing this four years later. You probably have completely forgotten about this, but I'll answer anyway. The  function is part of MediaWiki, so I don't know a whole lot about it. But, it's documented over here: ResourceLoader/Core modules. The  parameter is the ID for the HTML element that will be created; HTML elements don't have to have IDs, so the field is optional. You can't pass an index like you can with my script, but you can pass  to specify which existing link you want your new link to appear before. As for best practice with the formatting, it's really whatever you want -- just do whatever you think is easiest to read with the spacing/line breaks. – Iago Qnsi (User talk:IagoQnsi) 18:35, 12 April 2018 (UTC)