The search component was breaking down bootstrap dropdown menus. I traced the source of the problem, and figured one solution, BUT I don;t know how to do a pull request. So here I document problem and solution. Please consider as potential solution.
PROBLEM:
When loading a search component menu item, javascript console generated an error. This image the illustrates error in console:
In the file that triggers the error, chosen.jquery.js I found code which is implemented as PHP. This is the problem.
excerpt from file chosen.jquery.js lines 161 through 172 of the latest downloadable Joomla CMS package:
else {
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || Joomla.JText.('JGLOBAL_SELECT_AN_OPTION');
}
if (this.allow_custom_value) {
this.custom_group_text = this.form_field.getAttribute("data-custom_group_text") || this.options.custom_group_text || "Custom Value";
results_none_found_default = "Add custom value";
} else {
results_none_found_default = "No results match";
}
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || Joomla.JText.('JGLOBAL_SELECT_NO_RESULTS_MATCH');
};
Lines 161 and 171 call object Joomla.JText properties as if a PHP function was called method '_'.
SOLUTION
I solved this problem by modifying these two lines as follows:
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || Joomla.JText._('JGLOBAL_SELECT_AN_OPTION');
TO:
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || Joomla.JText['JGLOBAL_SELECT_AN_OPTION'];
AND
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || Joomla.JText._('JGLOBAL_SELECT_AN_OPTION');
TO:
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || Joomla.JText['JGLOBAL_SELECT_AN_OPTION'];
The solution calls the properties of the Joomla.JText object via the square brackets rather than the dot underscore etc...
Now, while in a search component menu item type, my Bootstrap dropdown menus work like a charm... (yes, I am a marketeer lol)
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-08-22 10:24:48 |
Closed in favour of #2679
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
Labels |
Added:
?
|
Hi @IberoMedia.
Creating a PullRequest is actually quite easy. You can just browse to the file in this repo, click the edit button and do the change. After saving you will be prompted with a form to create the PullRequest.
GitHub will automatically do the forking and branching for you behind the scenes.
Also, we currently still track issues in our JoomlaCode tracker (http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemBrowse&tracker_id=8103). If you could be so kind to open an item there and reference it back in your PR, that would be perfect.