- Issue created by @danielmellin
- fc8c7d2d committed on 1.x
Issue #3493601: Problem with SearchList in formatter, widget and .module
- fc8c7d2d committed on 1.x
I am getting an error with trying to set a icon on field_link.
Error loading icons: SyntaxError: JSON.parse: unexpected character at line 3 column 1 of the JSON data:
in bootstrapicon-iconpicker-menu.js
And the error
Error loading icons: Error: Failed to fetch icons:
in bootstrapicon-iconpicker-menu.js while trying to set the default icon on the widget or formatter
As far as I can see the bootstrapicon-iconpicker-menu.js wants a path to iconSearch.json file and not an array of icons, which the settingsForm() function in the formatter and widget are giving.
Also the formatters, widget and .module is trying the access the iconSearch.json file with
$base_path = Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString();
$searchList = $base_path . $this->extensionListModule->getPath('menu_bootstrap_icon') . '/js/iconSearch.json';
If the site has a language prefix as default, will result in it trying to find the file in /enmodules/contrib/menu_bootstrap_icon/js/iconSearch.json.
The correct path is /modules/contrib/menu_bootstrap_icon/js/iconSearch.json
Have the site language set to English as default and set "English (en) path prefix (Default language)" as 'en'
The error on the settings form for the formatter and widget:
The error while adding a icon to a link on content type:
Use the function
base_path()
instead of
Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString();
to ignore the language prefix.
And set
['#attached']['drupalSettings']['menu_bootstrap_icon']['icons']
to be the path to iconSearch.json instead of an array of icons.
Active
1.0
Code
Issue #3493601: Problem with SearchList in formatter, widget and .module