"allow display_field to be array, thus allow searching on multiple cols"

edited January 2016 in Modules
Hi --
I found this thread on Github: https://github.com/daylightstudio/FUEL-CMS/pull/290
I have names stored in first, middle, and last name columns. Is it possible to create a display_field which has all three?

Thanks!

Comments

  • edited 6:12AM
    The easiest way would be to overwrite the model's display_name function
    public function display_name($values) { // your custom code here }
  • edited January 2016
    Ah, so easy!

    But perhaps not...
    I added this to my module.php, but it isn't doing anything? I tried to put a die() inside of it, but the die() did not execute, so for some reason it's not even going through the function. Do I have to put it elsewhere or do something special to make the module see it?

    public function display_name($values){ if(!empty($values['id'])){ $getname = $this->attorneys_model->find('one', 'id ='.$values['id']); $values['display_name'] = $getname->name_f.' '.$getname->name_m.' '.$getname->name_l; return $values; } }

    In MY_fuel_modules.php, I tried to get rid of the display_field, but it didn't make the function execute.
    $config['modules']['attorneys'] = array( 'preview_path' => 'attorneys/{slug}', 'display_field' => 'name_l', 'search_field' => 'name_l' );
  • edited January 2016
    What version of FUEL are you using (you can find it under fuel/modules/fuel/config/fuel_constants.php)?
  • edited January 2016
    Version 1.3! Should I change versions?
    I also just found out that in MY_fuel_modules.php, the 'search_field' parameter only works if its value is identical to 'display_field.' In my case, I want to sort by date but display the title, so it's not effective to have them be the same. Is this a known issue?
  • edited 6:12AM
    I believe that is new to 1.3.1 so I would recommend an update to either the develop branch or 1.3.1.

    Try setting the default_col and default_order parameter to have the default table sorting be different then the display_field
Sign In or Register to comment.