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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Custom Site Config: HasManyComplexTableField


Go to End


2 Posts   2019 Views

Avatar
Deklin

Community Member, 16 Posts

12 July 2010 at 8:49am

How can I use HasManyComplexTableField with a Custom Site Config?

My code returns an error: "Can't figure out the data class of"

<?php
 
class CustomSiteConfig extends Extension {
 

	function extraStatics() {
		return array(
			'db' => array(
				'Link' => 'Text',
				'Text' => 'Text'
			),
			'has_many' => array(
				'Links' => 'Link'
			),
		);
	}

	public function updateCMSFields(FieldSet $fields) {
		$tablefield = new HasManyComplexTableField (
			$this,
			'Links',
			'Link',
			array(
				'Link' => 'Link',
				'Text' => 'Link Text'
			),
			'getCMSFields_forPopup'
		);
	
		$fields->addFieldToTab( 'Root.Content.Links', $tablefield );
		return $fields;
	}
}

?>

Avatar
Martijn

Community Member, 271 Posts

12 July 2010 at 9:56pm