Drupal - Add external code into project

0 votes
221 views
added Aug 17, 2018 in Drupal by LC Marshal Captain (25,790 points)

Add the following codes into yourprojectname/sites/all/themes/yourtheme/template.php

<?php 
// add font awesome css
  drupal_add_css('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', [
    'group' => 'CSS_THEME',
    'every_page' => true,
    'type' => 'external'
  ]);
  // add material icon css
  drupal_add_css('https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700|Material+Icons', [
    'group' => 'CSS_THEME',
    'every_page' => true,
    'type' => 'external'
  ]);

  // jquery match height
  drupal_add_js(drupal_get_path('theme', 'yourthemename') ."/assets/js/jquery.matchHeight.min.js", [
    'group' => 'JS_THEME',
    'every_page' => true,
    'requires_jquery' => true
  ]);

  // js cookie
  drupal_add_js(drupal_get_path('theme', 'yourthemename') ."/assets/js/js.cookie.min.js", [
    'group' => 'JS_THEME',
    'every_page' => true,
    'requires_jquery' => true
  ]);
  
  ?>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...