You are here

protected function ParagraphsType::getFileByUuid in Paragraphs 8

Gets the file entity defined by the UUID.

Parameters

string $uuid: The file entity's UUID.

Return value

\Drupal\file\FileInterface|null The file entity. NULL if the UUID is invalid.

3 calls to ParagraphsType::getFileByUuid()
ParagraphsType::getIconFile in src/Entity/ParagraphsType.php
Returns the icon file entity.
ParagraphsType::postSave in src/Entity/ParagraphsType.php
Acts on a saved entity before the insert or update hook is invoked.
ParagraphsType::restoreDefaultIcon in src/Entity/ParagraphsType.php
Restores the icon file from the default icon value.

File

src/Entity/ParagraphsType.php, line 294

Class

ParagraphsType
Defines the ParagraphsType entity.

Namespace

Drupal\paragraphs\Entity

Code

protected function getFileByUuid($uuid) {
  if ($id = \Drupal::service('paragraphs_type.uuid_lookup')
    ->get($uuid)) {
    return $this
      ->entityTypeManager()
      ->getStorage('file')
      ->load($id);
  }
  return NULL;
}