You are here

private function AudioFieldPluginBase::loadFileFromItem in AudioField 8

Load a file from an audio file entity.

Parameters

\Drupal\file\Plugin\Field\FieldType\FileItem|\Drupal\link\Plugin\Field\FieldType\LinkItem $item: Item for which we are loading the file entity.

Return value

\Drupal\file\FileInterface FileInterface from the item.

5 calls to AudioFieldPluginBase::loadFileFromItem()
AudioFieldPluginBase::getAudioDescription in src/AudioFieldPluginBase.php
Get a title description from an audiofield entity.
AudioFieldPluginBase::getAudioSource in src/AudioFieldPluginBase.php
Get source URL from an audiofield entity.
AudioFieldPluginBase::getFiletype in src/AudioFieldPluginBase.php
Get the filetype for an item.
AudioFieldPluginBase::getUniqueId in src/AudioFieldPluginBase.php
Get a unique ID for an item.
AudioFieldPluginBase::validateEntityAgainstPlayer in src/AudioFieldPluginBase.php
Validate that this entity will work with this player.

File

src/AudioFieldPluginBase.php, line 382

Class

AudioFieldPluginBase
Base class for audiofield plugins. Includes global functions.

Namespace

Drupal\audiofield

Code

private function loadFileFromItem($item) {

  // Load the associated file.
  return File::load($item
    ->get('target_id')
    ->getCastedValue());
}