/** * {@inheritDoc} */ public function toHtml() { try { $this->setAttribute('src', $this->getResizedImagePath($this->width, $this->height)); } catch (\Exception $e) { // @TODO: it's not nice to silently exit here. // should log raised exception at least. return ''; } return parent::toHtml(); }
/** * @param string $key * @param string $url * @return ResponseContext */ public function addCssLinkToLayoutSnippet($key, $url) { $linkTag = new HtmlTag('link'); $linkTag->setAttribute('rel', 'stylesheet'); $linkTag->setAttribute('type', 'text/css'); $linkTag->setAttribute('href', $url); $this->addToLayoutSnippet($key, $linkTag->toHtml()); return $this; }