You are here

function _cmf_status_query_build in Content Management Filter 7

Same name and namespace in other branches
  1. 6.2 cmf.module \_cmf_status_query_build()
  2. 6 cmf.module \_cmf_status_query_build()

Query_build function for status field.

1 string reference to '_cmf_status_query_build'
cmf_filters in ./cmf.module
List node administration filters that can be applied.

File

./cmf.module, line 723
@brief Content management filter module file

Code

function _cmf_status_query_build($key, $value, $index) {

  // Note: no exploitable hole as $key/$value have already been checked when submitted.
  list($key, $value) = explode('-', $value, 2);
  if ($key == 'sticky') {

    // This allows sticky-encoded weighting (like Weight module) to also work.
    return array(
      'where' => 'n.' . $key . ' ' . ($value == 1 ? '>' : '<') . ' %d',
      'value' => 1 - $value,
    );
  }
  else {
    return array(
      'where' => 'n.' . $key . ' = %d',
      'value' => $value,
    );
  }
}