You are here

function customfilter_get_filter in Custom filter 5

Get a filter from the database.

Parameters

$fid: ID of the filter.

$cols: The columns to retrive.

Return value

The filter.

2 calls to customfilter_get_filter()
customfilter_filter_edit in ./customfilter.module
Edit a filter.
customfilter_menu in ./customfilter.module
Implements hook_menu().

File

./customfilter.module, line 895

Code

function customfilter_get_filter($fid, $cols = '*') {
  static $filters;
  if (!is_array($filters)) {
    $filters = array();
  }
  if (!isset($filters[$fid])) {

    // Prepare columns to select
    if (!is_array($cols)) {
      $cols = array(
        $cols,
      );
    }
    $columns = join(', ', $cols);
    $filter = db_fetch_array(db_query("SELECT {$columns} FROM {customfilter_filter} WHERE fid = %d", $fid));
    $filters[$fid] = $filter;
  }
  return $filters[$fid];
}