Drupal 7: CTools adding CSS to Modal window with example[ctools_add_css()]

In Drupal core the function drupal_add_css() help us to achieve adding CSS for a specific pages. The CTools modal popup will not support core drupal_add_css() functions. We have to use CTools functions for adding CSS files to modal window. The function ctools_add_css() will help to adding CSS files into modal popup windows. The function accepts filename, Module name and path for adding the CSS file.​

Syntax:

ctools_add_css(FILE_NAME, MODULE_NAME, PATH);
 
FILE_NAME : The CSS file for load in Modal popup.
MODULE_NAME : The Module name that file contains.
PATH : The internal path of the file.

Example:

Path:
test_module1
  -- test_module1.module
  -- css
    --  test_module1.css
ctools_add_css('test_module1', 'test_module1', 'css');
 
Path:
test_angular
  -- test_angular.module
  -- js
    -- test_angular.css
    -- lib
      --  angular.css
ctools_add_css('test_angular', 'test_angular', 'css'); // Adding CSS file.
ctools_add_css('angular', 'test_angular', 'css/lib'); // Adding Angular CSS file.

Similar Post:
Drupal 7: CTools adding JS to Modal window with example[ctools_add_js()]

Category: