You are here

function ctools_attach_css in Chaos Tool Suite (ctools) 7

Format a css file name for use with $form['#attached']['css'].

This helper function is used by ctools but can also be used in other modules in the same way as explained in the comments of ctools_include.

$form['#attached']['css'] = array(
  ctools_attach_css('collapsible-div'),
);
$form['#attached']['css'][ctools_attach_css('collapsible-div')] = array(
  'preprocess' => FALSE,
);

Parameters

$file: The base file name to be included.

$module: Optional module containing the include.

$dir: Optional subdirectory containing the include file.

Return value

string A string containing the appropriate path from drupal root.

1 call to ctools_attach_css()
CtoolsModuleTestCase::testAttachCss in tests/ctools.test
Test the ctools_attach_css function returns the expected paths.

File

./ctools.module, line 227
CTools primary module file.

Code

function ctools_attach_css($file, $module = 'ctools', $dir = 'css') {
  return drupal_get_path('module', $module) . "/{$dir}/{$file}.css";
}