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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Link from DOM list


Go to End


4 Posts   1313 Views

Avatar
dbenton

Community Member, 23 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, 4102 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, 23 Posts

16 June 2011 at 5:37am

Thanks, UncleCheese!

Btw, do you accept donations for DOM?

Avatar
UncleCheese

Forum Moderator, 4102 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