You are here

function og_menu_single_get_link_mlid_or_create in OG Menu Single 7

Fetched or crate space mlid of an entity.

Return value

The active menu link ID for current group.

3 calls to og_menu_single_get_link_mlid_or_create()
og_menu_single_form_menu_edit_item_alter in ./og_menu_single.module
Implements hook_form_FORMID_alter().
og_menu_single_get_active_plid in ./og_menu_single.module
Fetched the space mlid of the current space in the menu.
og_menu_single_menu_edit_form in ./og_menu_single.admin.inc
OG variables edit variable form.

File

./og_menu_single.module, line 450
Creates a single menu per organic group on a site.

Code

function og_menu_single_get_link_mlid_or_create($entity_type, $entity_id) {
  $mlid = og_menu_single_get_link_mlid($entity_type, $entity_id);
  if (!$mlid && ($entities = entity_load($entity_type, array(
    $entity_id,
  )))) {
    _og_menu_single_save_group_link(reset($entities));
    $mlid = og_menu_single_get_link_mlid($entity_type, $entity_id, TRUE);
  }
  return $mlid;
}