I'm having a problem with the font-your-face module. Basically I'm getting an error because the API Key for google fonts is not working. I have posted an issue in the module's queue on github last week but no response so far.

I can see the code added to fix it in the D8 version of the module (which I have used on a couple different sites). Basically it implements  hook_form_FORM_ID_alter() to give the user a chance to put in a new API Key.

I think I can figure out how to modify the code to make it work, but my problem is I don't know what to use for the FORM_ID. In D8 it's called "google_fonts_api_form_font_settings_alter" so should I just assume that font_settings is the right FORM_ID to use?

Maybe a silly question, but I feel like I'm missing something. 

Accepted answer

Hi @leeksoup

I had a look on one of my sites that uses the module and for form id is:

fontyourface-ui-settings-form

How I found it:

  1. Open the form at admin/config/user-interface/fontyourface
  2. Right click near the top and select "Inspect element"
  3. Find the form wrapper and look for id.

I don't use the Google Fonts module myself so can't test, but hopefully that will work.

Comments

Hi @leeksoup

I had a look on one of my sites that uses the module and for form id is:

fontyourface-ui-settings-form

How I found it:

  1. Open the form at admin/config/user-interface/fontyourface
  2. Right click near the top and select "Inspect element"
  3. Find the form wrapper and look for id.

I don't use the Google Fonts module myself so can't test, but hopefully that will work.

@yorkshirepudding - Thank you! That's just what I needed. In the code, it's actually fontyourface_ui_settings_form (with underscores rather than dashes).

Now it's working ... I only have to figure out how to move the request for the API key to a different spot on the form.

ETA: I also appreciate your pointing out where to find this info in the future. :)