Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Object::useCustomClass('TabSet', 'MyTabSet');

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

Page: 1
Go to End
Author Topic: 1387 Views
  • Martijn
    Avatar
    Community Member
    271 Posts

    Object::useCustomClass('TabSet', 'MyTabSet'); Link to this post

    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?

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Object::useCustomClass('TabSet', 'MyTabSet'); Link to this post

    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

    1387 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.