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.

Customising the CMS /

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

Object::useCustomClass('TabSet', 'MyTabSet');


Go to End


2 Posts   1928 Views

Avatar
Martijn

Community Member, 271 Posts

28 July 2010 at 5:15am

Edited: 28/07/2010 5:16am

I'm theming the admin area, but i run into trouble with popups.

I have LeftAndMainDecorator with this working code in init():

Requirements::block(THIRDPARTY_DIR . '/tabstrip/tabstrip.css');
Requirements::css('admintheme/mytheme/tabstrip/tabstrip.css');

Now I have new styled tabs. But when I have a popup from SecurityAdmin or AssetAdmin, those lines as skipped.

I thought of extending TabSet to block the default css and add my own and use:

Object::useCustomClass('TabSet', 'MyTabSet');

to substitute the original TabSet with MyTabSet.

Of course this does not work.....

Any Idea how I can change requirements in popup forms?

Avatar
Martijn

Community Member, 271 Posts

29 July 2010 at 1:21am

Edited: 29/07/2010 1:28am

ok I try this now a different way by using ComplexTableField::requirementsForPopupCallback

I created an Extension to AssetAdmin and add the method requirementsForPopupCallback

function requirementsForPopupCallback(){
		Requirements::block(THIRDPARTY_DIR . '/tabstrip/tabstrip.css');
		Requirements::css(ADMINTHEME_DIR . '/css/tabstrip/tabstrip.css');
	}

if I call : AssetTableField::hasMethod('requirementsForPopupCallback'); from my lefandmaindecoraot it returns true

but it does not get called in ComplexTableField::forTemplate() where I can see this code:

// Append requirements from instance callbacks
		$parent = $this->getParentController();
		if($parent instanceof ComplexTableField) {
			$callback = $parent->requirementsForPopupCallback;
		} else {
			$callback = $parent->getParentController()->requirementsForPopupCallback;
		}
		if($callback) call_user_func($callback, $this);

if i echo $parent->getParentController() it returns AssetTableField, so I added requirementsForPopupCallback() in AssetTableField, but no joy.

How should I implement requirementsForPopupCallback ?

EDIT :: the forTemplate is in ComplexTableField_Popup