getEnvironment(); $url = $environment->relativeUrl($data); if ($url === null) { throw new Exception(sprintf('Could not get relative url for %s', $data)); } $nodeFactory = $parser->getNodeFactory(); return $parser->getNodeFactory()->createFigureNode( $nodeFactory->createImageNode($url, $options), $document ); } }