Has anybody tried to make a Custom Search field on a Member Role Decorator?
I've got a custom MemberRole extends DataObjectDecorator
and the updateForumFields functions all work sweet.
Now I want to have my Suburb field shown as a DropdownField instead of a TextField in a default search.
function extraStatics() {
return array( 'db' => array(
'Suburb' => 'Varchar',
'City' => 'Varchar'),
'searchable_fields' => array( 'FirstName','Surname','Suburb','City' ),
);
This bit works and shows the Suburb and City fields as text boxes.
I'm getting the "build the Search form" function to call the following function (in the Role Decorator .php ) and it barfs on the
$context = parent::getDefaultSearchContext();
line with [User Error] Uncaught Exception: Object->__call(): the method 'scaffoldsearchfields' does not exist on 'MemberRole'
public function getCustomSearchContext(){
$context = parent::getDefaultSearchContext();
$context->removeFieldByName('Suburb');
$suburbs = self::get_suburbs();
if($suburbs){
$suburbMap = array_combine($suburbs, $suburbs);
}else{
$suburbMap = null;
}
$suburbField = new DropDownField( 'Suburb', 'Suburb', $suburbMap);
$suburbField->sethasEmptyDefault(true);
$context->addField($suburbField);
return $context;
}
Do i need to rewrite/copy the scaffoldsearchfields function (which sounds wrong) or am I just calling it incorrectly?