private function SvgEmbedProcess::loadFile in SVG Embed 8
Same name and namespace in other branches
- 2.0.x src/SvgEmbedProcess.php \Drupal\svg_embed\SvgEmbedProcess::loadFile()
 
Parameters
string $uuid:
Return value
\SimpleXMLElement|bool
2 calls to SvgEmbedProcess::loadFile()
File
- src/
SvgEmbedProcess.php, line 58  
Class
- SvgEmbedProcess
 - Class SvgEmbedProcess.
 
Namespace
Drupal\svg_embedCode
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;
}