You are here

function LinkitPluginEntity::buildGroup in Linkit 7.2

When "group_by_bundle" is active, we need to add the bundle name to the group, else just return the entity label.

Return value

a string with the group name.

Overrides LinkitPlugin::buildGroup

2 calls to LinkitPluginEntity::buildGroup()
LinkitPluginEntity::autocomplete_callback in plugins/linkit_plugins/linkit-plugin-entity.class.php
The autocomplete callback function for the Linkit Entity plugin.
LinkitPluginFile::buildGroup in plugins/linkit_plugins/linkit-plugin-file.class.php
Adds the file scheme to the group if "group_by_scheme" is activated.
2 methods override LinkitPluginEntity::buildGroup()
LinkitPluginFile::buildGroup in plugins/linkit_plugins/linkit-plugin-file.class.php
Adds the file scheme to the group if "group_by_scheme" is activated.
LinkitPluginTaxonomy_Term::buildGroup in plugins/linkit_plugins/linkit-plugin-taxonomy_term.class.php
When "group_by_bundle" is active, we need to add the bundle name to the group, else just return the entity label.

File

plugins/linkit_plugins/linkit-plugin-entity.class.php, line 165
Define Linkit entity plugin.

Class

LinkitPluginEntity
@file Define Linkit entity plugin.

Code

function buildGroup($entity) {

  // Get the entity label.
  $group = $this->entity_info['label'];

  // If the entities by this entity should be grouped by bundle, get the
  // name and append it to the group.
  if (isset($this->conf['group_by_bundle']) && $this->conf['group_by_bundle']) {
    $bundles = $this->entity_info['bundles'];
    $bundle_name = $bundles[$entity->{$this->entity_key_bundle}]['label'];
    $group .= ' · ' . check_plain($bundle_name);
  }
  return $group;
}