From 4aa31782e6b957d355064118532525ddb91e335f Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Sun, 8 Mar 2015 20:44:12 +0100 Subject: [PATCH] add functions for easily adding images --- include/cbsm/util/document.php-class | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/cbsm/util/document.php-class b/include/cbsm/util/document.php-class index e641d23..c063544 100755 --- a/include/cbsm/util/document.php-class +++ b/include/cbsm/util/document.php-class @@ -172,6 +172,9 @@ class ExtendedDocument extends DOMDocument { function appendLink($target, $value = '') { return $this->appendChild($this->createElementLink($target, $value)); } + function appendImage($src, $alt_text = '') { + return $this->appendChild($this->createElementImage($src, $alt_text)); + } function appendFormDiv($action, $method, $name) { $formelem = $this->appendChild($this->createElementForm($action, $method, $name)); return $formelem->appendElement('div'); @@ -237,6 +240,13 @@ class ExtendedDocument extends DOMDocument { return $link; } + function createElementImage($src, $alt_text = '') { + $link = $this->createElement('img'); + $link->setAttribute('src', $src); + $link->setAttribute('alt', $alt_text); + return $link; + } + function createElementForm($action, $method, $name) { $formelem = $this->createElement('form'); $formelem->setAttribute('action', $action); -- 2.43.0