You are here

private function VideoFilter::classes in Video Filter 8

Video Filter classes.

1 call to VideoFilter::classes()
VideoFilter::process in src/Plugin/Filter/VideoFilter.php
Performs the filter processing.

File

src/Plugin/Filter/VideoFilter.php, line 231

Class

VideoFilter
Render Video Filter.

Namespace

Drupal\video_filter\Plugin\Filter

Code

private function classes($video) {
  $classes = [
    'video-' . $video['codec']['id'],
  ];

  // Add alignment.
  if (isset($video['align'])) {
    $classes[] = 'video-' . $video['align'];
  }

  // First match is the URL, we don't want that as a class.
  unset($video['codec']['matches'][0]);
  foreach ($video['codec']['matches'] as $match) {
    $classes[] = 'vf-' . strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $match));
  }
  return $classes;
}