1.20.x entity_bundle_layout_access.inc EntityBundleLayoutAccess::summary()

Provides a human-readable summary of this access check's behavior.

Parameters

$contexts: An array containing available contexts.

Return value

string: The summary string for this access check.

Overrides LayoutAccess::summary

File

modules/layout/plugins/access/entity_bundle_layout_access.inc, line 52
Plugin to provide access control based upon entity bundle.

Class

EntityBundleLayoutAccess
@file Plugin to provide access control based upon entity bundle.

Code

function summary() {
  $entity_info = entity_get_info($this->entity_type);

  $names = array();
  foreach (array_filter($this->settings['bundles']) as $bundle) {
    $names[] = check_plain($entity_info['bundles'][$bundle]['label']);
  }

  if (empty($names)) {
    return t('Entity is a specific type.');
  }

  return format_plural(count($names), '@entity is %bundles', '@entity is one of: %bundles', array('@entity' => $entity_info['bundle label'], '%bundles' => implode(', ', $names)));
}