You are here

private function SvgEmbedProcess::loadFile in SVG Embed 2.0.x

Same name and namespace in other branches
  1. 8 src/SvgEmbedProcess.php \Drupal\svg_embed\SvgEmbedProcess::loadFile()

Parameters

string $uuid:

Return value

\SimpleXMLElement

1 call to SvgEmbedProcess::loadFile()
SvgEmbedProcess::translate in src/SvgEmbedProcess.php

File

src/SvgEmbedProcess.php, line 69

Class

SvgEmbedProcess
Class SvgEmbedProcess.

Namespace

Drupal\svg_embed

Code

private function loadFile($uuid) : SimpleXMLElement {
  $text = '';
  try {

    /** @var File $file */
    if ($file = $this->entityTypeManager
      ->getStorage('file')
      ->loadByProperties([
      'uuid' => $uuid,
    ])) {
      $text = file_get_contents($file
        ->getFileUri());
    }
  } catch (InvalidPluginDefinitionException $e) {

    // TODO: log this exception.
  } catch (PluginNotFoundException $e) {

    // TODO: log this exception.
  }
  return new SimpleXMLElement($text);
}