Commit 2a16e987 authored by B_man's avatar B_man
Browse files

Issue #3035738 by B_man, hestenet, TR, drumm: Adding a documentation guide to...

Issue #3035738 by B_man, hestenet, TR, drumm: Adding a documentation guide to "Contributed modules" is totally dysfunctional
parent 357370da
......@@ -2660,6 +2660,21 @@ function drupalorg_form_alter(&$form, &$form_state, $form_id) {
}
}
/**
* Implements hook_node_prepare().
*/
function drupalorg_node_prepare($node) {
//If this is a new node with OG Menu, put in the menu before og_menu has a chance to do stuff.
$menu = menu_get_item();
if (($context = og_context()) && $menu['page_callback'] == 'node_add' && (($node->type == 'guide' || $node->type == 'documentation'))) {
$parent_guide = entity_metadata_wrapper('node', node_load($context['gid']));
if (!$parent_guide->field_new_page_and_guide_review->value()) {
$parent_menu = og_menu_get_group_menus(['node' => [$context['gid']]]);
$node->storage['og_menu'] = array_merge($node->storage['og_menu'], $parent_menu);
}
}
}
/**
* Implements hook_form_FORM_ID_alter().
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment