You are here

public static function AddJsClasses::preRender in Facets Block 8

Pre-render callback to add js classes to the facets_block block.

File

src/AddJsClasses.php, line 23

Class

AddJsClasses
AddJsClasses pre-render callback.

Namespace

Drupal\facets_block

Code

public static function preRender($elements) {
  $elements['#attributes']['class'][] = 'block-facets-ajax';
  if (empty($elements['#id'])) {
    $elements['#id'] = Html::getUniqueId($elements['#plugin_id']);
  }
  $elements['#attributes']['class'][] = "js-facet-block-id-{$elements['#id']}";
  return $elements;
}