You are here

public function BackgroundMedia::buildBackgroundMediaLocalVideo in Bootstrap Styles 1.0.x

Helper function to the background media local video style.

Parameters

object $media_entity: A media entity object.

object $field_name: The Media entity local video field name.

Return value

string Background media local video style.

1 call to BackgroundMedia::buildBackgroundMediaLocalVideo()
BackgroundMedia::build in src/Plugin/BootstrapStyles/Style/BackgroundMedia.php

File

src/Plugin/BootstrapStyles/Style/BackgroundMedia.php, line 484

Class

BackgroundMedia
Class BackgroundMedia.

Namespace

Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style

Code

public function buildBackgroundMediaLocalVideo($media_entity, $field_name) {
  $fid = $media_entity
    ->get($field_name)->target_id;
  $file = File::load($fid);
  return $file
    ->createFileUrl();
}