You are here

function LinkitSearchPluginEntity::createGroup in Linkit 7.3

Create a group text.

Parameters

$entity: The entity object.

Return value

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

2 calls to LinkitSearchPluginEntity::createGroup()
LinkitSearchPluginEntity::fetchResults in plugins/linkit_search/entity.class.php
Implements LinkitSearchPluginInterface::fetchResults().
LinkitSearchPluginFile::createGroup in plugins/linkit_search/file.class.php
Overrides LinkitSearchPluginEntity::createGroup().
2 methods override LinkitSearchPluginEntity::createGroup()
LinkitSearchPluginFile::createGroup in plugins/linkit_search/file.class.php
Overrides LinkitSearchPluginEntity::createGroup().
LinkitSearchPluginTaxonomy_term::createGroup in plugins/linkit_search/taxonomy_term.class.php
Overrides LinkitSearchPluginEntity::createGroup().

File

plugins/linkit_search/entity.class.php, line 163
Define Linkit entity search plugin class.

Class

LinkitSearchPluginEntity
Represents a Linkit entity search plugin.

Code

function createGroup($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;
}