Adding to useful link target "_blank"

Discussion in 'Templates customization' started by mrross1, Dec 24, 2015.

Thread Status:
Not open for further replies.
  1. mrross1

    mrross1 aMember Pro Customer

    Joined:
    Jul 28, 2012
    Messages:
    21
    How to add own link to "Useful Links" block in member's area
    <?php
    Am_Di::getInstance()->hook->add(Am_Event::GET_MEMBER_LINKS, 'getLinks');
    function getLinks(Am_Event $event){
    $event->addReturn('LINK TITLE', '/url/');
    }

    I used the above script in site.php to add a new link. Where and how would I add further HTML target"_blank", so that the link opens in a new window.

    Thanks,
    Gary
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    You can did it the following way:
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::GET_MEMBER_LINKS, function(Am_Event $e){
        
    $e->addReturn(array(
            
    'label' => 'LINK TITLE',
            
    'href' =>  '/url/',
            
    'target' => '_blank'
        
    ));
    });
  3. mrross1

    mrross1 aMember Pro Customer

    Joined:
    Jul 28, 2012
    Messages:
    21
    Thanks for that.
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    You are welcome!
Thread Status:
Not open for further replies.

Share This Page