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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

HasOneComplexTableField


Go to End


2 Posts   1449 Views

Avatar
Phill

Community Member, 81 Posts

29 January 2012 at 4:10am

Hi

Im trying to use a HasOneComplexTableField to manage the relationship between a page and a dataobject, below is the code im using to add the field to page. When i use the add button it adds it to the table but its not selected by default, i have to check the radio button to link it to the page. Is there anyway to automatically link the dataobject to the age without having to click the radio button?

$ctf = new HasOneComplexTableField(
	$this->owner,
	'OpenGraph',
	'OpenGraph',
	'',
	'',
	''
);
$ctf->setOneToOne();
 $fields->addFieldToTab('Root.FBOpenGraph',$ctf);

Avatar
martimiz

Forum Moderator, 1391 Posts

29 January 2012 at 5:10am

The basic ComplexTableField will automatically add all created objects to the page it's on... The hasone version shows all available objects, then lets you select the ones you want to add to the page...