You are here

entity_share_medias_file.abstract.inc in Entity Share 7

Class for handling file Medias in RTE.

File

modules/entity_share_medias/modules/entity_share_medias_file/includes/entity_share_medias_file.abstract.inc
View source
<?php

/**
 * @file
 * Class for handling file Medias in RTE.
 */

/**
 * Abstract Class for medias.
 */
abstract class EntityShareMediasFileAbstract extends EntityShareMediasProviderAbstract {
  const CUSTOM_UUID_PREFIX = 'entity_share-';

  /**
   * Types of field handled by the current class.
   *
   * @var array
   *   Type of field types managed.
   */
  protected $managedFieldTypes = array(
    'file',
  );

  /**
   * Get a file Id from a UUID.
   *
   * @param string $uuid
   *   UUID of the file.
   *
   * @return mixed
   *   The fileId.
   */
  public function getFileIdFromUuid($uuid) {
    $file = entity_uuid_load('file', array(
      $uuid,
    ));
    $file = current($file) ? current($file) : NULL;
    return $file->fid;
  }

  /**
   * Return file uuid.
   *
   * @param object $file
   *   The file object.
   *
   * @return string
   *   The file UUID.
   */
  public function getUuid($file) {
    return $file->uuid;
  }

}

Classes

Namesort descending Description
EntityShareMediasFileAbstract Abstract Class for medias.