function Callbacks::advancedCommandsAddCssCallback

Ajax callback for 'add_css'.

File

core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php, line 266

Class

Callbacks
Simple object for testing methods as Ajax callbacks.

Namespace

Drupal\ajax_forms_test

Code

public static function advancedCommandsAddCssCallback($form, FormStateInterface $form_state) : AjaxResponse {
  $response = new AjaxResponse();
  $response->addCommand(new AddCssCommand([
    [
      'href' => 'my/file.css',
      'media' => 'all',
    ],
    [
      'href' => 'https://example.com/css?family=Open+Sans',
      'media' => 'all',
    ],
  ]));
  return $response;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.