You are here

function css3pie_init in css3pie 6

File

./css3pie.module, line 72
css3pie.module a very simple Drupal module to implement the css3pie.com javascript to your drupal and make the css selectors configurable over ui. This module creates a real css file on drupal files folder and add them via drupal_add_css.

Code

function css3pie_init() {

  // get the path of css3pie file
  $path_to_css3pie_css_file = file_directory_path() . '/css3pie/css3pie.css';
  $path_to_css3pie_js_file = file_directory_path() . '/css3pie/css3pie.js';
  $path_to_pie_js_file = libraries_get_path('PIE') . '/PIE.js';

  // add to drupal´ css only if we have a cssfile
  if ($path_to_css3pie_css_file && !variable_get('css3pie_css_use_js_mode', FALSE)) {
    drupal_add_css($path_to_css3pie_css_file);
  }
  if ($path_to_pie_js_file && variable_get('css3pie_css_use_js_mode', FALSE) && $path_to_css3pie_js_file) {
    $pie_js_to_html_head = '<!--[if lt IE 10]><script language="javascript" type="text/javascript" src="' . file_create_url($path_to_pie_js_file) . '"></script>' . PHP_EOL . '<script language="javascript" type="text/javascript" src="' . file_create_url('css3pie/css3pie.js') . '"></script><![endif]-->' . PHP_EOL;
    drupal_set_html_head($pie_js_to_html_head);
  }
}