Small patch to allow modules to specify a default value for "Display siblingmenu trees as: "
simonvwade - May 13, 2009 - 14:34
| Project: | Submenu Tree |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
// Inject some sane defaults
if (empty($node->submenutree_enable)) {
$node->submenutree_enable = 0;
- $node->submenutree_display = SUBMENUTREE_DISPLAY_MENU;
+ if( !$node->submenutree_display ) {
+ $node->submenutree_display = SUBMENUTREE_DISPLAY_MENU;
+ }
$node->submenutree_weight = 1;
}
if (empty($node->siblingmenutree_enable)) {
$node->siblingmenutree_enable = 0;
- $node->siblingmenutree_display = SUBMENUTREE_DISPLAY_MENU;
+ if( !$node->siblingmenutree_display ) {
+ $node->siblingmenutree_display = SUBMENUTREE_DISPLAY_MENU;
+ }
$node->siblingmenutree_weight = 1;
}

#1
This means that developers can do the following:
function hook_form_alter(&$form, $form_state, $form_id) {
if( strpos($form_id, 'node_form') > 0 ) {
$node = $form['#node'];
if( !$node->siblingmenutree_enable ) {
$node->submenutree_display = SUBMENUTREE_DISPLAY_BLOCK_MENU;
}
if( !$node->submenutree_enable ) {
$node->submenutree_display = SUBMENUTREE_DISPLAY_BLOCK_MENU;
}
}
}
#2
Hi,
I suspect I understand what you're trying to achieve, but I'm not absolutely certain. To prevent possible confusion, can you please explain it to me? There may be an easier way to do this.
Also, please don't supply 'patches' like that. Please generate a patch file and attach it. It's a bit more work, but less error prone.