You are here

function css3pie_preprocess_html in css3pie 7.2

theme preprocess to add the css file

Parameters

<type> $vars:

File

./css3pie.module, line 98
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_preprocess_html(&$vars) {
  ctools_include('css');

  // get the path of css3pie file
  $path_to_css3pie_css_file = _css3pie_build_css3pie_css();
  $path_to_css3pie_js_file = file_default_scheme() . '://css3pie/css3pie.js';
  $piejslibrary = drupal_get_library('css3pie', 'css3pie_js');

  // get file from library array because the filename is in the key..
  $path_to_pie_js_file = NULL;
  if (is_array($piejslibrary)) {
    foreach ($piejslibrary['js'] as $file => $options) {
      $path_to_pie_js_file = $file;
    }
  }

  // add to drupal´ css only if we have a cssfile
  if ($path_to_css3pie_css_file && !variable_get('css3pie_css_use_js_mode')) {
    drupal_add_css($path_to_css3pie_css_file, array(
      'browsers' => array(
        'IE' => 'lt IE 10',
        '!IE' => FALSE,
      ),
    ));
  }
  if ($path_to_pie_js_file && variable_get('css3pie_css_use_js_mode') && $path_to_css3pie_js_file) {
    $pie_js_to_html_head = array(
      '#type' => 'markup',
      '#markup' => '<!--[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($path_to_css3pie_js_file) . '"></script><![endif]-->' . PHP_EOL,
    );
    drupal_add_html_head($pie_js_to_html_head, 'css3pie');
  }
}