You are here

private function SvgEmbedProcess::loadFile in SVG Embed 8

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

Parameters

string $uuid:

Return value

\SimpleXMLElement|bool

2 calls to SvgEmbedProcess::loadFile()
SvgEmbedProcess::extract in src/SvgEmbedProcess.php
SvgEmbedProcess::translate in src/SvgEmbedProcess.php

File

src/SvgEmbedProcess.php, line 58

Class

SvgEmbedProcess
Class SvgEmbedProcess.

Namespace

Drupal\svg_embed

Code

private function loadFile($uuid) {
  try {

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

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

    // TODO: log this exception.
  }
  return FALSE;
}