You are here

protected function AudioFieldPluginBase::getClassType in AudioField 8

Get the class type for an entity.

Parameters

\Drupal\file\Plugin\Field\FieldType\FileItem|\Drupal\link\Plugin\Field\FieldType\LinkItem $item: Item for which we are determining class type.

Return value

string The class type for the item.

6 calls to AudioFieldPluginBase::getClassType()
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.

... See full list

File

src/AudioFieldPluginBase.php, line 317

Class

AudioFieldPluginBase
Base class for audiofield plugins. Includes global functions.

Namespace

Drupal\audiofield

Code

protected function getClassType($item) {

  // Handle File entity.
  if (get_class($item) == 'Drupal\\file\\Plugin\\Field\\FieldType\\FileItem') {
    return 'FileItem';
  }
  elseif (get_class($item) == 'Drupal\\link\\Plugin\\Field\\FieldType\\LinkItem') {
    return 'LinkItem';
  }
  return NULL;
}