Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Custom Site Config: HasManyComplexTableField

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

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

Page: 1
Go to End
Author Topic: 1678 Views
  • Deklin
    Avatar
    Community Member
    16 Posts

    Custom Site Config: HasManyComplexTableField Link to this post

    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;
       }
    }

    ?>

  • Martijn
    Avatar
    Community Member
    271 Posts
    1678 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.