You are here

function ajax_command_add_css in Drupal 7

Creates a Drupal Ajax 'add_css' command.

This method will add css via ajax in a cross-browser compatible way.

This command is implemented by Drupal.ajax.prototype.commands.add_css() defined in misc/ajax.js.

Parameters

$styles: A string that contains the styles to be added.

Return value

An array suitable for use with the ajax_render() function.

See also

misc/ajax.js

Related topics

2 calls to ajax_command_add_css()
ajax_forms_test_advanced_commands_add_css_callback in modules/simpletest/tests/ajax_forms_test.module
Ajax callback for 'add_css'.
ajax_render in includes/ajax.inc
Renders a commands array into JSON.

File

includes/ajax.inc, line 1313
Functions for use with Drupal's Ajax framework.

Code

function ajax_command_add_css($styles) {
  return array(
    'command' => 'add_css',
    'data' => $styles,
  );
}