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   545 Views

Avatar
dbenton

Community Member, 22 Posts

15 June 2011 at 9:23am

Edited: 15/06/2011 9:24am

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

Forum Moderator, 4093 Posts

16 June 2011 at 5:13am

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

Community Member, 22 Posts

16 June 2011 at 5:37am

Thanks, UncleCheese!

Btw, do you accept donations for DOM?

Avatar
UncleCheese

Forum Moderator, 4093 Posts

16 June 2011 at 5:46am

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