For some reason this module works differently in my local testing to my online server. When local I cannot use the "font displays" feature, but can enable the fonts and use them in my CSS. With my online server its the direct opposite, cant use the fonts in css since they dont load, but the Font Displays do work. Im on the Pantheon.io server platform.

On my local dev environment when using 'Font Displays' feature I get the following error.

Notice: Undefined property: Drupal\fontyourface\Entity\FontDisplay::$css_fallbacks in fontyourface_font_css() (line 302 of modules/fontyourface/fontyourface.module).

fontyourface_font_css(Object, Object) (Line: 79)
fontyourface_page_attachments(Array) (Line: 297)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 273)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

Macronomicus created an issue. See original summary.

btmash’s picture

Assigned: Unassigned » btmash
Status: Active » Postponed (maintainer needs more info)

@Macronomicus,

Thanks for submitting the issue. I'm definitely a quite confused since this was one of the first things I was checking. I guess my first set of questions are

  • What font modules do you have enabled?
  • What were your font display settings?
  • What version of php are you running locally(I have tested with php 5.6+)

Any screenshots you can post around this would also be immensely helpful.

btmash’s picture

Component: Miscellaneous » Code (general)
Assigned: btmash » Unassigned
Status: Postponed (maintainer needs more info) » Needs review

@macronomicus, I think I have narrowed down some of the issues. It has to do with the module hook load order not being respected by its weight (which I'm still not sure why it happens). Anyways, with the new dev release, the load order will be updated if you click on any submit button on the font-your-face settings form. Additionally, the issue around the undefined property should be resolved as well (doing an empty check beforehand). Please try the latest dev and let me know if it works.

criscom’s picture

I had the same issue with version 8.x-3.0-alpha3. I tried to upate to the latest dev version. And it worked after I did the following:

drush pm-unistall google_fonts_api
drush en google_fonts_api

Then I re-imported from google_fonts_api.

Currently working as a charm. Thanks!

mfischer@m2.engineering’s picture

Looks like a switch from direct access to attribute css_fallbacks to access via method getFallback(). Fixed it, see attached patch.

Status: Needs review » Needs work

The last submitted patch, 5: fontyourface-Undefined_property_-_css_fallbacks-2754665.patch, failed testing.

btmash’s picture

@mfischer, Sorry for not getting back on this sooner. I reviewed the patch and it looks good. Committed and pushed. Thank you for your patch.

btmash’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.