Greetings.
I have a dropdown menu on ModelAdmin that, by default, displays the primary-key/ID. I want said dropdown rather to display the Value. Please advise.
My code is as follows:
<?php
class Player extends DataObject {
private static $db = array(
'PlayerName'=>'Varchar(50)',
'DateJoined'=>'Date',
'Tries'=>'Int',
'DropGoals'=>'Int',
'Penalties'=>'Int',
'Conversions'=>'Int',
);
private static $has_one = array(
"TeamJoin"=>"Team"
);
private static $field_labels = array(
'PlayerName'=>'Name of Player',
'DateJoined'=>'Date of Joining',
'Tries'=> 'Total Tries Scored',
'DropGoals'=>'Total Drop Kicks Scored',
'Penalties'=>'Number of Penalties Converted',
'Conversions'=>'Number of Tries Converted',
'TeamJoin'=>'Team this player belongs to',
);
private static $summary_fields = array(
'PlayerName',
'DateJoined',
'Team',
);
public function getCMSfield() {
$fields->removeByName('TeamJoin');
$fields = Fieldlist::create(
TextField::create('PlayerName'),
DateField::create('DateJoined')
->setConfig('showcalendar', true),
NumericField::create('Tries'),
NumericField::create('DropGoals'),
NumericField::create('Penalties'),
NumericField::create('Conversions'),
DropdownField::create('TeamJoin')
);
}
}
Thanks!
//TwinkleToes