Hi,
I have this simple module:
$config['modules']['games'] = array(
'module_name' => 'Games',
'filters' => array(
'partners' => array('label' => 'Socio', 'type' => 'select')
)
);
As you can see, I added a filter. This filter eventually appear on top of the list, but it doesn't contain any option.
Is there a way to populate this dropdown from the model?
Thank you!
Comments
// to prevent the querying from happening outside of the admin if (defined('FUEL_ADMIN')) { $CI =& get_instance(); $CI->load->model('games_model'); $game_options = $CI->games_model->options_list(); } else { $game_options = array(); } $config['modules']['games'] = array( 'module_name' => 'Games', 'filters' => array( 'partners' => array('label' => 'Socio', 'type' => 'select', 'options' => $game_options) ) );
This will be changed though in the next release to make it easier.
in fuel/modules/fuel/controllers/module.php:
below line 322 and 369, add:
if(method_exists($this->model, 'filters'))
$this->filters = $this->model->filters($this->filters);
then in you simple module model, add:
function filters($filters = array()){
$filters['demos'] = array(
'label' => 'Demos',
'type' => 'select',
'options' => array('' => '', 1 => 1, 2 => 2, 3 => 3)
);
return $filters;
}