Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Link from DOM list

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 514 Views
  • dbenton
    Avatar
    Community Member
    22 Posts

    Link from DOM list Link to this post

    Hello,

    I would like include a link in the list view of a DOM field. I have the link working (code below), but I get a Facebox popup (with no content) when I click on it. How can I stop the popup from being triggered by my click event?

    Thanks,
    David

    My Dataobject (partial):

    function getLink ()
    {
       return '<a href="' . $this->Page()->Link('csv') . '/' . $this->ID . '">This link works</a>';
    }

    Page getCMSFields (partial, obviously):

    $f->addFieldToTab("Root.Content.Tab", new DataObjectManager(
       $this,
       'MyDataObjects',
       'MyDataObject',
       array(
          'link' => 'Export'
       ),
       'getCMSFields_forPopup'
    ));

  • UncleCheese
    Avatar
    4085 Posts

    Re: Link from DOM list Link to this post

    You use DataObjectManagerAction for this. In your DataObject class, define customDOMActions()..

       public function customDOMActions() {
        return new DataObjectManagerAction(
           'Test', // The title of the action, tooltip text
           'http://google.com', // the link
           'window', // the behaviour (popup, refresh, delete, window)
           "mysite/images/icon.png" // path to the icon for the action
        );
       }

    Please note that the behaviour "window" was just added in the last commit, so you'll have to update from the git repo to have that feature.

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • dbenton
    Avatar
    Community Member
    22 Posts

    Re: Link from DOM list Link to this post

    Thanks, UncleCheese!

    Btw, do you accept donations for DOM?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Link from DOM list Link to this post

    Yes, at my website, http://www.leftandmain.com. Seems to be the thing to do these days! Thanks in advance.

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

    514 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.