You are here

function _og_menu_single_save_group_link in OG Menu Single 7

Saves menu link to single menu for group.

Parameters

$node: A group node object that link will be created/updated for.

$mlid: Current link ID if exists for that group.

3 calls to _og_menu_single_save_group_link()
og_menu_single_get_link_mlid_or_create in ./og_menu_single.module
Fetched or crate space mlid of an entity.
og_menu_single_node_insert in ./og_menu_single.module
Implements hook_node_insert().
og_menu_single_node_update in ./og_menu_single.module
Implements hook_node_update().

File

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

Code

function _og_menu_single_save_group_link($node, $mlid = null) {
  if (og_menu_single_is_enabled_group('node', $node->type)) {
    $link = array(
      'mlid' => $mlid,
      'link_title' => $node->title,
      'link_path' => 'node/' . $node->nid,
      'menu_name' => OG_MENU_SINGLE_MENU_NAME,
      'options' => array(
        'attributes' => array(
          'title' => t('Menu for group') . ' ' . $node->title,
        ),
      ),
    );
    menu_link_save($link);
  }
}