Jump to:

22978 Posts in 11807 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » ModelAdmin $summary_fields image width

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 2
Go to End
Author Topic: 4692 Views
  • Mad_Clog
    Avatar
    Community Member
    78 Posts

    Re: ModelAdmin $summary_fields image width Link to this post

    Problem is, the link you provided contains information about DataObjectManager instead of ModelAdmin (which this thread is about).
    I keep ending up with "Unable to traverse to related object field"
    So any other thoughts?

  • patjnr
    Avatar
    Community Member
    101 Posts

    Re: ModelAdmin $summary_fields image width Link to this post

    Hi

    This works fine for me.

    static $has_one = array(
                      'Advertiser' => 'Advertiser',
                      'AdvertImage' => 'FittedImage',
       );   
       
       static $searchable_fields = array(
                      'TargetURL' => 'ExactMatchFilter',
                      'Title' => 'ExactMatchFilter',
       );
       static $summary_fields = array(
                      'TargetURL',
                      'AdvertImageThumbnail',
                      'Title',
                      'ToolTipTitle',
       );
       
       public function AdvertImageThumbnail() {
        return $this->AdvertImage()->CMSThumbnail();
       }

    ta

  • Mad_Clog
    Avatar
    Community Member
    78 Posts
    4692 Views
Page: 1 2
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.