Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Opening links in new browser window
olivier_h
New
I've installed the "Add Menu Item" plugin and was wondering if it is possible to set up a link with this plugin to open in a new browser tab? (target="_blank")
Thanks!
Olivier
Tagged:
0
Comments
you have to modify addlink in the Add Menu Item plugin
this is how add link works in the core.
for reference:
https://github.com/vanilla/vanilla/blob/Vanilla_2.2.1/applications/dashboard/modules/class.menumodule.php#L57
public function addLink($Group, $Text, $Url, $Permission = false, $Attributes = '', $AnchorAttributes = '')
so the SIXTH item is the Anchor Attributes is the one you will need to change in the plugin.
in the Add Menu Item plugin
you would probably need to add 'target' => '_blank' into the array similar to here in the addLink Item for the links you want to change.
example here.
https://vanillaforums.org/discussion/comment/225072/#Comment_225072
for multiple key values just add a comma between the key value pairs in array e.g. array('target' => '_blank', 'key'->'value', )
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
Above will work with virijvlinder's themes, however if you are using a smarty templated theme - you would need to resort to adding the link in your tpl or use js to look for .sub-menu and add add an attrubute to it.
http://stackoverflow.com/questions/804256/how-do-i-add-target-blank-to-a-link-within-a-specified-div/804360
and add the js to your template between literal tags.
With smarty templated themes - the anchor attribute (6th item in addlink) is essentially thrown away, and so is anything else except the class.
the {custom_menu} hard codes some info in, and the garden theme link - throws the rest of the info away.
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.