To hit a requirement, I wrote http://drupal.org/node/713026, which works great for most modules, except this one. Since Menu Breadcrumbs runs a variable_set() during the form build process, it doesn't allow other modules to properly form_alter() its form and control how variables are stored.
The problem is in _menu_breadcrumb_get_menus():
if ($match_cache_rebuild) {
variable_set('menu_breadcrumb_pattern_matches_rebuild', FALSE);
$match_cache_old = $match_cache;
$match_cache = array();
}
This attempt at optimization actually breaks some Drupal behavior other modules count on.
Something similar happens in _menu_breadcrumb_process_new_menus().
Comments
Comment #1
jweowu commentedCould you possibly point me to the documentation where this is covered?
I've never heard of variable_set() being considered a bug if used outside of form submission.
Comment #2
agentrickardI'll mark it a feature request, then. The problem is that the form sets the variable on submit and the re-sets it on form build, which defeats the purpose of the submit WRT form_alter.
In general in Drupal, variables that are set as internal markers for the module can be set outside of form submission, but we shouldn't do both.
Comment #3
jweowu commentedOkay, so this seems like some nuance of form building that I'm unfamiliar with.
I'm somewhat confused about your initial post, though, as
menu_breadcrumb_pattern_matches_rebuildis not a form element.menu_breadcrumbs_menuis the only variable which is set both by thesystem_settings_form()submission handler, and also directly by avariable_set()in_menu_breadcrumb_process_new_menus().Is that the only one which is causing you problems? Or am I still not getting the point?
Comment #4
agentrickardThe form builder (display) function calls another function which calls variable_set(), which breaks what I am trying to do. I'll have to look closer at the code again tomorrow.
Essentially, it looks like menu order is recalculated and saved on form build _as well as_ on form submit, which is not desirable if we want to override the submit handler.
Comment #5
xurizaemonCleaning up issue queue. Closing all D6 issues.
If you believe this issue still applies to a supported version, feel free to re-open it. That would be a great time to check if the issue contains clear steps for reproducing the bug!
Thanks and sorry for any inconvenience.