Doesn't look to be, the last commit to the effected file was a month ago.
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.
- Previous 10 entries
- 1
- 2
- Page 33(current)
This will be fixed in 3.0.1 (currently RC2).
seems that in silverstripe 3.0.2 it works if you use
public function getThumbnail() {
return $this->Image()->CMSThumbnail();
}
i just made a quick tutorial about it here too:
http://www.silverstriperesources.com/articles/silverstripe-3-0-2-grid-fields-with-thumbnails/
Thank you!
For some reason the Futuraweb solution doesn't seem to work with ModelAdmins gridfield.
Have to use this nasty thing
<?php
class SliderImage extends DataObject {
static $db = array(
'Description' => 'Varchar(255)'
);
static $has_one = array(
'Image' => 'Image'
);
static $summary_fields = array(
'ImageNice' => 'CustomPicTitle',
'DescriptionNice' => 'CustomDescTitle'
);
static $casting = array(
'ImageNice' => 'HTMLText',
'DescriptionNice' => 'Varchar'
);
public function getImageNice() {
return $this->Image()->CMSThumbnail();
}
public function getDescriptionNice() {
return $this->Description;
}
}
Otherwise I get an error "Unable to traverse to related object field [Thumbnail] on [SliderImage]"
And using the casting for Description is the only way the gridfield columns pick up my custom titles aswell.
And using the casting for Description is the only way the gridfield columns pick up my custom titles aswell.
You can no longer change field names through $summary_fields. You should use $field_labels, "Title" => "Titel"
I've just fixed the problem when trying to add thumbnails to model admin in SS3
If you're getting "Can't traverse to [image something] on your object"
then you just need to add searchable fields, and it fixes it!
Something like this: (use your field names obviously)
static $searchable_fields = array(
'ID',
'Name'
);
Rob Clarkson
I'm having an issue with this also, using the following code, it looks like the 'get' Function is referring to the field alias, not the field name
<?php
class Speaker extends DataObject {
private static $db = array(
'Name' => 'Varchar',
'Title' => 'Varchar',
'Company' => 'Varchar',
);
private static $has_one = array(
'Photo' => 'Image'
);
private static $summary_fields = array(
'Name',
'Title',
'Company',
'Thumbnail' => 'SpeakerPhoto' // but i want this to be 'Speaker Photo' as the label
);
||
||
\ /
\/
// this should ideally be getThumbnail
public function getSpeakerPhoto() { // can't use get with 'Speaker Photo'
if ($Image = $this->Photo()->ID) {
return $this->Photo()->SetWidth(80);
} else {
return '(No Image)';
}
}
}
thanks for any advice
J
UPDATE:
it turns out all fields would need to be aliased in this case, in order for the get function to refer to the field name, not the field alias
this works now..
private static $summary_fields = array(
'Name' => 'Name',
'Title' => 'Title',
'Company' => 'Company',
'Thumbnail' => 'Speaker Photo'
);
public function getThumbnail() { // references the field name above, not the alias
if ($this->Photo()->exists()) {
return $this->Photo()->SetWidth(80);
} else {
return '(No Image)';
}
}
- Previous 10 entries
- 1
- 2
- Page 33(current)