Skip to content

Instantly share code, notes, and snippets.

@muskie9
Created February 25, 2016 21:54
Show Gist options
  • Save muskie9/795a2b283700cd0df39c to your computer and use it in GitHub Desktop.
Save muskie9/795a2b283700cd0df39c to your computer and use it in GitHub Desktop.
<?php
class YourModelAdmin extends ModelAdmin{
/**
* @return SearchContext
*/
public function getSearchContext()
{
$context = parent::getSearchContext();
if ($this->modelClass == 'YourClass') {
$newField = DropdownField::create('q[FieldName]');
$context->getFields()->replaceField('YourFieldToReplace', $newField);
}
return $context;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment