Skip to content

Cannot read property 'fontawesome' of undefined #170

@aDarkling

Description

@aDarkling

Sorry, I don't have time to make patches right now. The fix to this bug is at the end of this report.

I installed Kalatheme 4 on a site with CKEditor module installed and then I tried to place an image in a text field using the Media plugin.
The Media Browser came up as usual.
I selected the image I wanted.
A new modal came up showing the image & a form input to select which view mode I wanted to display.
When I selected a view mode, a javascript alert dialog popped up showing the following:

An error occured while attempting to process /system/ajax:
Cannot read property 'fontawesome' of undefined

I traced the error to line 78 of dist/js/kalatheme.pkg.js. There was no Drupal.settings.kalatheme property, so when it tried to check the fontawesome subproperty an exception was triggered.
I tried enabling & disabling loading of FontAwesome in the theme, but that made no difference.

Finally fixed it by replacing:
iconClasses = Drupal.settings.kalatheme.fontawesome === true ? "fa fa-refresh fa-spin" : "glyphicon glyphicon-refresh glyphicon-spin";
with:
iconClasses = (Drupal.settings.kalatheme && Drupal.settings.kalatheme.fontawesome === true) ? "fa fa-refresh fa-spin" : "glyphicon glyphicon-refresh glyphicon-spin";

Not elegant, but it did the job.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions