function ctools_term_vocabulary_ctools_access_summary

Provide a summary description based upon the checked term_vocabularys.

1 string reference to 'ctools_term_vocabulary_ctools_access_summary'
term_vocabulary.inc in plugins/access/term_vocabulary.inc
Plugin to provide access control based upon term vocabulary.

File

plugins/access/term_vocabulary.inc, line 78

Code

function ctools_term_vocabulary_ctools_access_summary($conf, $context) {
    if (!isset($conf['type'])) {
        $conf['type'] = array();
    }
    $vocabularies = taxonomy_get_vocabularies();
    _ctools_term_vocabulary_ctools_access_map_vids($conf);
    $names = array();
    if (!empty($conf['machine_name'])) {
        foreach (array_filter($conf['machine_name']) as $machine_name) {
            foreach ($vocabularies as $vocabulary) {
                if ($vocabulary->machine_name === $machine_name) {
                    $names[] = check_plain($vocabulary->name);
                    continue;
                }
            }
        }
    }
    if (empty($names)) {
        return t('@identifier is any vocabulary', array(
            '@identifier' => $context->identifier,
        ));
    }
    return format_plural(count($names), '@identifier vocabulary is "@machine_names"', '@identifier vocabulary is one of "@machine_names"', array(
        '@machine_names' => implode(', ', $names),
        '@identifier' => $context->identifier,
    ));
}