function ctools_entity_bundle_ctools_access_summary

Provide a summary description based upon the checked entity_bundle.

1 string reference to 'ctools_entity_bundle_ctools_access_summary'
entity_bundle.inc in plugins/access/entity_bundle.inc
Plugin to provide access control based upon entity bundle.

File

plugins/access/entity_bundle.inc, line 113

Code

function ctools_entity_bundle_ctools_access_summary($conf, $context, $plugin) {
    if (!isset($conf['type'])) {
        $conf['type'] = array();
    }
    list($plugin_name, $entity_type) = explode(':', $plugin['name']);
    if (!$entity_type) {
        return t('Error, misconfigured entity_bundle access plugin');
    }
    $entity = entity_get_info($entity_type);
    $names = array();
    foreach (array_filter($conf['type']) as $type) {
        $names[] = check_plain($entity['bundles'][$type]['label']);
    }
    if (empty($names)) {
        return t('@identifier is any bundle', array(
            '@identifier' => $context->identifier,
        ));
    }
    return format_plural(count($names), '@identifier is bundle "@types"', '@identifier bundle is one of "@types"', array(
        '@types' => implode(', ', $names),
        '@identifier' => $context->identifier,
    ));
}