function og_menu_form_node_type_form_alter in Organic Groups Menu (OG Menu) 7.3
Same name and namespace in other branches
- 7.2 og_menu.module \og_menu_form_node_type_form_alter()
Implements hook_form_FORMID_alter().
Integration with menu module for node type admin page. Hides OG Menus from available menu settings.
File
- ./
og_menu.module, line 570 - Integrates Menu with Organic Groups. Lots of menu forms duplication in OG context.
Code
function og_menu_form_node_type_form_alter(&$form, &$form_state) {
if (!variable_get('og_menu_show_nodetype', FALSE)) {
// Remove OG Menus from the list by default.
$query = db_select('menu_custom', 'mc');
$query
->join('og_menu', 'ogm', 'ogm.menu_name = mc.menu_name');
$query
->fields('mc', array(
'menu_name',
));
$result = $query
->execute()
->fetchCol();
foreach ($result as $ogblock) {
unset($form['menu']['menu_options']['#options'][$ogblock]);
}
}
// Provide a setting to enable OG Menus on this content type.
$form['menu']['og_menu_enable'] = array(
'#type' => 'checkbox',
'#title' => t("Enable for OG Menus"),
'#default_value' => variable_get('og_menu_enable_' . $form['#node_type']->type, FALSE),
'#description' => t("Allow nodes of this content type to be added to OG Menus."),
);
if (!og_is_group_content_type('node', $form['#node_type']->type)) {
$form['menu']['og_menu_enable']['#description'] .= ' <strong>';
$form['menu']['og_menu_enable']['#description'] .= t("This setting will not\n have any effect until you enable this type as Group Content");
$form['menu']['og_menu_enable']['#description'] .= '</strong>';
}
}