You are here

function ctools_term_ctools_access_summary in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 plugins/access/term.inc \ctools_term_ctools_access_summary()

Provide a summary description based upon the checked terms.

1 string reference to 'ctools_term_ctools_access_summary'
term.inc in plugins/access/term.inc
Plugin to provide access control based upon specific terms.

File

plugins/access/term.inc, line 133
Plugin to provide access control based upon specific terms.

Code

function ctools_term_ctools_access_summary($conf, $context) {
  $vocab = taxonomy_vocabulary_load($conf['vid']);
  if ($vocab->tags) {
    $terms = explode(', ', $conf[$vocab->vid]);
  }
  else {
    $terms = array();
    foreach ($conf[$vocab->vid] as $tid) {
      $term = taxonomy_get_term($tid);
      $terms[] = $term->name;
    }
  }
  return format_plural(count($terms), '@term can be the term "@terms"', '@term can be one of these terms: @terms', array(
    '@terms' => implode(', ', $terms),
    '@term' => $context->identifier,
  ));
}