Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Link from DOM list


Reply

4 Posts   523 Views

Avatar
dbenton

15 June 2011 at 9:23am (Last edited: 15 June 2011 9:24am), Community Member, 22 Posts

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'
));

Avatar
UncleCheese

16 June 2011 at 5:13am 4085 Posts

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

Avatar
dbenton

16 June 2011 at 5:37am Community Member, 22 Posts

Thanks, UncleCheese!

Btw, do you accept donations for DOM?

Avatar
UncleCheese

16 June 2011 at 5:46am 4085 Posts

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