You are here

function og_entity_label in Organic groups 7

Wrapper function for entity_label() to return some text if label isn't found.

Parameters

$entity_type: The entity type.

$entity: The entity object.

4 calls to og_entity_label()
og_create_group in ./og.module
Callback to create a new OG group.
og_field_crud_group in ./og.field.inc
Create update or delete a group, based on the field CRUD.
og_set_breadcrumb in ./og.module
Set breadcrumbs according to a given group.
og_ui_subscribe in og_ui/og_ui.pages.inc
Manage user subscription to a group.

File

./og.module, line 3100
Enable users to create and manage groups with roles and permissions.

Code

function og_entity_label($entity_type, $entity) {
  $label = '';
  if (!empty($entity)) {
    $label = entity_label($entity_type, $entity);
    if (!$label) {
      list($id) = entity_extract_ids($entity_type, $entity);
      $label = t('Entity @entity_type ID @id', array(
        '@entity_type' => $entity_type,
        '@id' => $id,
      ));
    }
  }
  return $label;
}