You are here

function _css3pie_build_css3pie_js in css3pie 7.2

Same name and namespace in other branches
  1. 6 css3pie.module \_css3pie_build_css3pie_js()

helper function get all selectors and generates content for js file

Parameters

<type> $js:

Return value

<type> path to new created file

1 call to _css3pie_build_css3pie_js()
_css3pie_build_css3pie_functionality in ./css3pie.module
helper function to build the module functionality

File

./css3pie.module, line 262
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_build_css3pie_js() {
  $output = '';

  // invoke hook_css3pie in all modules to get the selectors
  $css3pie_selectors = module_invoke_all('css3pie');
  $output .= "\$(function() {\n";
  $output .= "if (window.PIE) {\n";
  $output .= "\$(function() {\n";
  foreach ($css3pie_selectors as $namespace => $selectors) {
    foreach ($selectors as $a => $selector) {
      $output .= "\$('" . $selector . "').each(function() {\n";
      $output .= "PIE.attach(this);\n";
      $output .= "});\n";
    }
  }
  $output .= "}\n";
  $output .= "});";
  return _css3pie_create_css3pie_js($output);
}