0

I am using Drupal's hook_form_alter to add a stylesheet into one of my forms (user registration form). My code does add the stylesheet to jquery.extend(Drupal.settings) as sites\/all\/themes\/mytheme\/css\/font-awesome-min.css:1, but this does not allow me to use the stylesheet as when I reference classes that are in it, they don't load as the CSS file does not show up as an import URL or link in <head>. Any help would be appreciated.

function mytheme_form_alter(&$form, &$form_state, $form_id) {

    if ( $form_id == 'user_register_form' )
    {
    $form['#attached']['css'] = array(drupal_get_path('theme', 'mytheme') . '/css/font-awesome-min.css');
    }
Luka
  • 1,718
  • 3
  • 19
  • 29
Jeremy
  • 327
  • 1
  • 7
  • 17

1 Answers1

-1

Add 'file' at the end of $form['#attached']['css'] array, like this:

$form['#attached']['css'] = array(drupal_get_path('theme', 'mytheme') . '/css/font-awesome-min.css', 'file');
xurshid29
  • 4,172
  • 1
  • 20
  • 25
  • Thank you, except this doesnt seem to change anything in the source apart from in jQuery.extend to sites\/all\/themes\/mytheme\/css\/font-awesome-min.css":1,"file":1 - No file shows in . Any ideas? – Jeremy Sep 08 '13 at 17:22