Advanced Modules w/ list_items enum filter
I've looked around the forum and can't find an answer ... probably not looking for the right thing.
Situation:
I have a table with an enum column of locale values. I want to be able to filter the items in list view by their value in the enum column. Ideally by passing an options_list as the filter. I know that I can manually add all the enum values to an array and add it to my modules config (*_fuel_modules.php) file, but I don't want to be managing to lists of values and I assume there is a better way to do this.
Thanks in advance for your help.
Comments
$options = array(); if (defined('FUEL_ADMIN')) { $CI =& get_instance(); $CI->load->model('my_model'); $info = $CI->my_model->field_info('my_field'); $options = $info['options']; }
I wrap the call in a conditional so that it will only load the database if you are in the FUEL admin.
http://www.getfuelcms.com/user_guide/libraries/my_model/table_class_functions
I'm trying to get it to work as a filter and show up next to the search at the top. I'm trying to break down the Assets module because the "Asset Folder" drop down functions exactly how I want mine to. The part I'm have trouble with is pushing the drop down to the filters array.
How should I go about overriding the assets module init values form the model?
require_once(FUEL_PATH.'/controllers/Module.php'); class Translations extends Module { function __construct() { parent::__construct(); } function items() { $this->filters['translation_locale']['options'] = array( 'foo' => 'bar', 'hello' => 'world' ); parent::items(); } }