Showing specific categories of tags in layout

I am using the tag and category modules (v1.0) and have a question about including it in a layout.

In MY_fuel_layouts.php file I've included

'tags_people' => array('type' => 'multi', 'label'=>'Tags', 'model' => 'Fuel_tags_model', 'sorting' => TRUE, 'mode' => 'multi'),
This shows all of the tags that have been created as I would expect.

For my purposes, I've created the tags and placed them under different categories (ex. People, Places, Things) What I would like to happen is to only show tags that are part of a specific category (ex People). How would I specify the category in the layout?

Comments

  • edited 2:49AM
    You can use the 'model_params' property which should be an array of the parameters that we are passing to what will eventually be the options_list method on the fuel_tags_model. In this case, the first parameter is the value of the options list, the second value is the label, and the third parameter is the where condition that you can pass. Give something like this a shot (haven't tested it out yet):
    'tags_people' => array('type' => 'multi', 'label'=>'Tags', 'model' => 'Fuel_tags_model', 'model_params' => array('id', 'name', array('category_id' => 1)), 'sorting' => TRUE, 'mode' => 'multi'),

    More documentation on the options_list method can be found here:
    http://docs.getfuelcms.com/libraries/my_model#func_options_list
  • edited 2:49AM
    Worked like a charm, thanks for the help.
Sign In or Register to comment.