You are here

function _purl_menu_edit_submit_recurse in Persistent URL 7

Same name and namespace in other branches
  1. 6 purl.admin.inc \_purl_menu_edit_submit_recurse()

Recuses though a menu tree and applies a purl behavior to each link.

Parameters

$tree: A (portion) of a menu tree as generated by menu_tree_all_data() @param $behavior The purl behavior to save in the options array of the menu links. Either 'enabled' or 'disabled'.

1 call to _purl_menu_edit_submit_recurse()
purl_menu_edit_submit in ./purl.admin.inc
@todo Please document this function.

File

./purl.admin.inc, line 309
Admin pages for the purl module.

Code

function _purl_menu_edit_submit_recurse($tree, $behavior) {
  foreach ($tree as $id => $item) {
    $link = $tree[$id]['link'];
    if ($behavior == 'disabled') {
      $link['options']['purl'] = 'disabled';
    }
    else {
      unset($link['options']['purl']);
    }
    menu_link_save($link);
    if ($link['has_children']) {
      _purl_menu_edit_submit_recurse($tree[$id]['below'], $behavior);
    }
  }
}