You are here

public function VideoFilterBase::getRatio in Video Filter 8

Get video player ratio.

Overrides VideoFilterInterface::getRatio

File

src/VideoFilterBase.php, line 39

Class

VideoFilterBase
Defines base methods for all video filter plugin instances.

Namespace

Drupal\video_filter

Code

public function getRatio() {
  $ratio = !empty($this->pluginDefinition['ratio']) ? $this->pluginDefinition['ratio'] : '';
  if (!empty($ratio) && preg_match('/(\\d+)\\/(\\d+)/', $ratio, $tratio)) {
    return $tratio[1] / $tratio[2];
  }
  return 1;
}