You are here

function cmf_filters in Content Management Filter 5

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

List node administration filters that can be applied.

Parameters

(optional) TRUE if the filter to be built serves the user profile page:

Return value

array with filter properties

3 calls to cmf_filters()
cmf_build_filter_query in ./cmf.module
Build the variable parts of the query to be performed regarding the filter status.
cmf_filter_form in ./cmf.module
Defines the form for content administration filters.
cmf_filter_form_submit in ./cmf.module
Handle post-validation form submission.

File

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

Code

function cmf_filters($true = NULL) {

  // Regular filters
  $filters['status'] = array(
    'title' => t('node status'),
    'options' => array(
      'status-1' => t('published'),
      'status-0' => t('not published'),
      'promote-1' => t('promoted'),
      'promote-0' => t('not promoted'),
      'sticky-1' => t('sticky'),
      'sticky-0' => t('not sticky'),
    ),
  );
  $filters['type'] = array(
    'title' => t('node type'),
    'options' => node_get_types('names'),
  );

  // The taxonomy filter
  if ($taxonomy = module_invoke('taxonomy', 'form_all', 1)) {
    $filters['category'] = array(
      'title' => t('category'),
      'options' => $taxonomy,
    );
  }

  // Cmf filters.
  $filters['title'] = array(
    'title' => t('title/subject'),
  );

  // Don't show these on the user page.
  if (!$true) {
    $filters['user'] = array(
      'title' => t('user list'),
      'options' => cmf_get_users(),
    );
    $filters['users'] = array(
      'title' => t('user name'),
    );
    $filters['role'] = array(
      'title' => t('user role'),
      'options' => cmf_get_roles('names'),
    );
    $filters['blocked'] = array(
      'title' => t('user status'),
      'options' => array(
        1 => t('active'),
        0 => t('blocked'),
      ),
    );
  }
  return $filters;
}