function flag_lists_get_flags in Flag Lists 7
Same name and namespace in other branches
- 6 flag_lists.module \flag_lists_get_flags()
- 7.3 flag_lists.module \flag_lists_get_flags()
Build array of all flag lists.
Return value
If limit and header arguments are provided, the paged flags, otherwise an array of all flags.
3 calls to flag_lists_get_flags()
- flag_lists_generate_lists_form_submit in ./
flag_lists.admin.inc - Submit handler for flag_lists_generate_lists_form.
- flag_lists_rebuild in ./
flag_lists.module - Update ALL flag lists with settings form values.
- theme_flag_lists_admin_page in ./
flag_lists.admin.inc - Theme the output for the main flag administration page.
File
- ./
flag_lists.module, line 1107 - The Flag Lists module.
Code
function flag_lists_get_flags($limit = NULL, $header = NULL) {
$flags = array();
if ($limit) {
$query = db_select('flag_lists_flags', 'fl')
->fields('fl')
->groupBy('fl.fid')
->extend('PagerDefault')
->limit($limit);
$query
->leftJoin('flag_types', 'ft', 'ft.fid = fl.pfid');
$query
->addExpression('GROUP_CONCAT(ft.type)', 'types');
$result = $query
->execute();
}
else {
$query = db_select('flag_lists_flags', 'fl')
->fields('fl')
->groupBy('fl.fid');
$query
->leftJoin('flag_types', 'ft', 'ft.fid = fl.pfid');
$query
->addExpression('GROUP_CONCAT(ft.type)', 'types');
$result = $query
->execute();
}
foreach ($result as $row) {
$flags[$row->name] = flag_flag::factory_by_row($row);
$flags[$row->name]->types = explode(',', $row->types);
$flags[$row->name]->uid = $row->uid;
}
return $flags;
}