Hi there,
Since I've now realised that $gridField doesn't use "getCMSFields_forPopup()"*, how can I control my gridField to specify:
1) The upload folder for an image?
2) The title/label of the field(s) that are displayed in the CMS? (so I can can display something like: "Brand Logo (100x50px)" for the logo image field, instead of just "Logo")
Many thanks.
*despite stumbling on an online tutorial that said it did... (http://www.inforbiro.com/blog-eng/silverstripe-gridfield-tutorial/)
ps here is my code:
Data Object (Partner.php)
class Partner extends DataObject {
// object's fields
public static $db = array(
'BrandName' => 'Varchar(255)',
'OrderBy' => 'Varchar(5)'
);
// One-to-one relationships
public static $has_one = array(
'Logo' => 'Image',
'GalleryPic' => 'Image',
'Partners' => 'Partners'
);
// Summary fields
public static $summary_fields = array(
'Logo.StripThumbnail' => 'Image',
'BrandName' => 'BrandName',
'OrderBy' => 'OrderBy'
);
static $default_sort = "OrderBy";
}
And the Holding Page (Partners.php)
public static $has_many = array(
'Partners' => 'Partner'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName("RightColumn");
$gridFieldConfig1 = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldAddNewButton('toolbar-header-right'),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(10),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm()
);
$gridField = new GridField("Partners", "Brand Partners:", $this->Partners(), $gridFieldConfig1);
$fields->addFieldToTab("Root.BrandPartners", $gridField);
return $fields;
}