Closed (fixed)
Project:
Themage
Version:
8.x-1.0
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2014 at 16:01 UTC
Updated:
7 Mar 2014 at 03:50 UTC
Jump to comment: Most recent
Function drupal_add_js() is no longer supported in it's usual way:
https://drupal.org/node/2169605
And also according to this issue:
https://drupal.org/node/2168113
Setting Themage theme as a default causes nice white screen with this error:
Fatal error: Call to undefined function drupal_add_css() in /home/quickstart/websites/example10.dev/sites/all/themes/Themage/themage.theme on line 12 Call Stack: 0.0001 327516 1. {main}() /home/quickstart/websites/example10.dev/index.php:0 0.0013 508844 2. drupal_handle_request() /home/quickstart/websites/example10.dev/index.php:15 0.0343 2193976 3. Drupal\Core\DrupalKernel->handle() /home/quickstart/websites/example10.dev/core/includes/bootstrap.inc:1635 0.0349 2260272 4. Drupal\Core\HttpKernel->handle() /home/quickstart/websites/example10.dev/core/lib/Drupal/Core/DrupalKernel.php:283 0.0350 2261080 5. Symfony\Component\HttpKernel\HttpKernel->handle() /home/quickstart/websites/example10.dev/core/lib/Drupal/Core/HttpKernel.php:65 0.0350 2261080 6. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/quickstart/websites/example10.dev/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:66 0.1205 6761916 7. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() /home/quickstart/websites/example10.dev/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:131 0.1210 6777420 8. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/quickstart/websites/example10.dev/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php:167 0.1211 6777896 9. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /home/quickstart/websites/example10.dev/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53 0.2609 9883780 10. call_user_func() /home/quickstart/websites/example10.dev/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164 0.2609 9883816 11. Drupal\Core\EventSubscriber\HtmlViewSubscriber->onHtmlPage() /home/quickstart/websites/example10.dev/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:0 0.2609 9884452 12. Drupal\Core\Page\DefaultHtmlPageRenderer->render() /home/quickstart/websites/example10.dev/core/lib/Drupal/Core/EventSubscriber/HtmlViewSubscriber.php:78 0.2609 9884832 13. drupal_render() /home/quickstart/websites/example10.dev/core/lib/Drupal/Core/Page/DefaultHtmlPageRenderer.php:23 0.2609 9885604 14. _theme() /home/quickstart/websites/example10.dev/core/includes/common.inc:3831 0.2623 9909312 15. themage_preprocess_html() /home/quickstart/websites/example10.dev/core/includes/theme.inc:674
As a quick solution I've just added '_' to the function's name:
_drupal_add_css('http://fonts.googleapis.com/css?family=Lobster', array('type' => 'external'));
and it works, but it's ugly hack (-:
I suppose this should be a proper solution (following by https://drupal.org/node/2169605):
/**
* Implements template_preprocess_html().
*/
function themage_preprocess_html(&$vars) {
// Add Lobster font.
//_drupal_add_css('http://fonts.googleapis.com/css?family=Lobster', array('type' => 'external'));
// Site is responsive, make sure initial scale is appropriate.
$viewport = array(
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1',
),
'#attached' => array(
'css' => array(
'http://fonts.googleapis.com/css?family=Lobster' => array(),
),
),
);
drupal_add_html_head($viewport, 'viewport');
}
It also works for me
(-:
Can you please also test it and apply to your theme?
I found also similar issue solved this way https://drupal.org/node/2176109
Comments
Comment #1
lsokolowski commentedComment #2
lsokolowski commentedComment #3
pplantinga commentedThanks for the bug report. This is fixed in http://drupalcode.org/project/Themage.git/commit/7ff84cf