|
|
@@ -0,0 +1,56 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace Opentalent\OtTemplating\ViewHelpers;
|
|
|
+
|
|
|
+
|
|
|
+use Closure;
|
|
|
+use Opentalent\OtTemplating\Page\OtPageRepository;
|
|
|
+use Opentalent\OtTemplating\ViewHelpers\RootPage\GetIdViewHelper;
|
|
|
+use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
|
|
|
+use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
|
+use TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper;
|
|
|
+use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
|
|
+
|
|
|
+/**
|
|
|
+ * -- Wrapper for the TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper --
|
|
|
+ * Display the image like the original viewhelper does, but does not
|
|
|
+ * throw an error if the file is not an image or if the
|
|
|
+ * image can not be displayed.
|
|
|
+ *
|
|
|
+ * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
|
|
|
+ *
|
|
|
+ * {ot:imageP()}
|
|
|
+ *
|
|
|
+ * @package Opentalent\OtTemplating\ViewHelpers
|
|
|
+ */
|
|
|
+class ImagePViewHelper extends ImageViewHelper
|
|
|
+{
|
|
|
+
|
|
|
+ /**
|
|
|
+ * -- This method is expected by Fluid --
|
|
|
+ * Declares the viewhelper's parameters
|
|
|
+ */
|
|
|
+ public function initializeArguments()
|
|
|
+ {
|
|
|
+ parent::initializeArguments();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * -- This method is expected by Fluid --
|
|
|
+ * Renders the content as html
|
|
|
+ *
|
|
|
+ * @return string Rendered tag
|
|
|
+ */
|
|
|
+ public function render() {
|
|
|
+ try {
|
|
|
+ return parent::render();
|
|
|
+ } catch (ResourceDoesNotExistException |
|
|
|
+ \UnexpectedValueException |
|
|
|
+ \RuntimeException |
|
|
|
+ \InvalidArgumentException
|
|
|
+ $e) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|