View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0011417 | mantisbt | plug-ins | public | 2010-01-20 07:14 | 2010-02-22 14:34 |
| Reporter | am-gtz | Assigned To | dhx | ||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | closed | Resolution | fixed | ||
| Target Version | 1.2.0 | Fixed in Version | 1.2.0 | ||
| Summary | 0011417: EVENTMENU* does not allow to return null | ||||
| Description | When the hook for a menu item returns null, an empty item is added, somehow like this Report Issue | | Change Log Sometimes it is useful that a plugin decides to not add any menu item, for example based on the current project. | ||||
| Additional Information | We will attach a patch for this. See also our branch: issue-event-menu-main-null-return on http://git.mantisforge.org/w/mantisbt/gtz-et.git | ||||
| Tags | patch | ||||
| Attached Files | issue11417.patch (2,399 bytes)
diff --git a/core/html_api.php b/core/html_api.php
index 7ece4da..c78c3d3 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -726,7 +726,9 @@ function print_menu() {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
- $t_menu_options[] = $t_callback_menu_options;
+ if (!is_null($t_callback_menu_options)) {
+ $t_menu_options[] = $t_callback_menu_options;
+ }
}
}
}
@@ -774,7 +776,9 @@ function print_menu() {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
- $t_menu_options[] = $t_callback_menu_options;
+ if (!is_null($t_callback_menu_options)) {
+ $t_menu_options[] = $t_callback_menu_options;
+ }
}
}
}
@@ -899,7 +903,9 @@ function print_summary_submenu() {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
- $t_menu_options[] = $t_callback_menu_options;
+ if (!is_null($t_callback_menu_options)) {
+ $t_menu_options[] = $t_callback_menu_options;
+ }
}
}
}
@@ -984,7 +990,9 @@ function print_manage_menu( $p_page = '' ) {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
- $t_menu_options[] = $t_callback_menu_options;
+ if (!is_null($t_callback_menu_options)) {
+ $t_menu_options[] = $t_callback_menu_options;
+ }
}
}
}
@@ -1096,7 +1104,9 @@ function print_account_menu( $p_page = '' ) {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
- $t_menu_options[] = $t_callback_menu_options;
+ if (!is_null($t_callback_menu_options)) {
+ $t_menu_options[] = $t_callback_menu_options;
+ }
}
}
}
@@ -1157,7 +1167,9 @@ function print_summary_menu( $p_page = '' ) {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
- $t_menu_options[] = $t_callback_menu_options;
+ if (!is_null($t_callback_menu_options)) {
+ $t_menu_options[] = $t_callback_menu_options;
+ }
}
}
}
| ||||
|
MantisBT: master-1.2.x d1a69cd2 2010-01-20 07:02 Alexander Menk Committer: dhx Details Diff |
Fix 0011417: Allow EVENT_MENU_MAIN plugin events to return null A plugin may decide not to print a menu entry via the EVENT_MENU_MAIN event hook based on which project is currently selected. Therefore the return value from EVENT_MENU_MAIN should be checked to make sure it isn't null. If it is null, then don't print anything in the menu. Signed-off-by: David Hicks <hickseydr@optusnet.com.au> |
Affected Issues 0011417 |
|
| mod - core/html_api.php | Diff File | ||
|
MantisBT: master 321ac71d 2010-01-20 07:02 Alexander Menk Committer: dhx Details Diff |
Fix 0011417: Allow EVENT_MENU_MAIN plugin events to return null A plugin may decide not to print a menu entry via the EVENT_MENU_MAIN event hook based on which project is currently selected. Therefore the return value from EVENT_MENU_MAIN should be checked to make sure it isn't null. If it is null, then don't print anything in the menu. Signed-off-by: David Hicks <hickseydr@optusnet.com.au> |
Affected Issues 0011417 |
|
| mod - core/html_api.php | Diff File | ||