You are here

function _onlyone_rebuild_menu in Allow a content type only once (Only One) 7

Rebuild the menu to change the menu label.

The menu will be rebuilded if the content type is configured to have only one node.

Parameters

string $content_type: The content type machine name.

1 call to _onlyone_rebuild_menu()
onlyone_node_insert in ./onlyone.module
Implements hook_node_insert().
1 string reference to '_onlyone_rebuild_menu'
onlyone_node_delete in ./onlyone.module
Implements hook_node_delete().

File

./onlyone.helpers.inc, line 254
Helper functions.

Code

function _onlyone_rebuild_menu($content_type) {

  // Getting the configured content types.
  $onlyone_content_types = variable_get('onlyone_node_types');

  // Checking if the content type is configured.
  if (in_array($content_type, $onlyone_content_types)) {

    // If is configured then we need to rebuild the menu.
    menu_rebuild();
  }
}