From: Robert Kaiser Date: Mon, 26 Sep 2016 17:29:43 +0000 (+0200) Subject: add a function for adding a form without
(which is fine in HTML5), and add... X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=commitdiff_plain;h=b8d168371c98b48193b8c61f8521618038feac1e;hp=6e698a41c5017150623531a9f2d6ec3baceda9c2 add a function for adding a form without
(which is fine in HTML5), and add a way to add an ID to either variant of the form addition --- diff --git a/include/cbsm/util/document.php-class b/include/cbsm/util/document.php-class index 6a36dfc..1563e9f 100755 --- a/include/cbsm/util/document.php-class +++ b/include/cbsm/util/document.php-class @@ -50,7 +50,11 @@ class ExtendedDocument extends DOMDocument { // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params) // returns the new child // - // function appendFormDiv($action, $method, $name) + // function appendForm($action, $method, $name, [$id]) + // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params) + // returns the new child + // + // function appendFormDiv($action, $method, $name, [$id]) // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params) // returns an HTML
that is a child of the new child // @@ -204,8 +208,11 @@ class ExtendedDocument extends DOMDocument { 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)); + function appendForm($action, $method, $name, $id = null) { + return $this->appendChild($this->createElementForm($action, $method, $name, $id)); + } + function appendFormDiv($action, $method, $name, $id = null) { + $formelem = $this->appendChild($this->createElementForm($action, $method, $name, $id)); return $formelem->appendElement('div'); } function appendInputHidden($name, $value) { @@ -286,11 +293,12 @@ class ExtendedDocument extends DOMDocument { return $img; } - function createElementForm($action, $method, $name) { + function createElementForm($action, $method, $name, $id = null) { $formelem = $this->createElement('form'); $formelem->setAttribute('action', $action); $formelem->setAttribute('method', $method); $formelem->setAttribute('name', $name); + $formelem->setAttribute('id', $id); return $formelem; } @@ -430,7 +438,11 @@ class ExtendedElement extends DOMElement { // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params) // returns the new child // - // function appendFormDiv($action, $method, $name) + // function appendForm($action, $method, $name, [$id]) + // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params) + // returns the new child + // + // function appendFormDiv($action, $method, $name, [$id]) // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params) // returns an HTML
that is a child of the new child // @@ -519,8 +531,11 @@ class ExtendedElement extends DOMElement { function appendImage($src, $alt_text = '') { return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text)); } - function appendFormDiv($action, $method, $name) { - $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name)); + function appendForm($action, $method, $name, $id = null) { + return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id)); + } + function appendFormDiv($action, $method, $name, $id = null) { + $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id)); return $formelem->appendElement('div'); } function appendInputHidden($name, $value) { @@ -597,7 +612,11 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params) // returns the new child // - // function appendFormDiv($action, $method, $name) + // function appendForm($action, $method, $name, [$id]) + // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params) + // returns the new child + // + // function appendFormDiv($action, $method, $name, [$id]) // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params) // returns an HTML
that is a child of the new child // @@ -686,8 +705,11 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { function appendImage($src, $alt_text = '') { return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text)); } - function appendFormDiv($action, $method, $name) { - $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name)); + function appendForm($action, $method, $name, $id = null) { + return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id)); + } + function appendFormDiv($action, $method, $name, $id = null) { + $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id)); return $formelem->appendElement('div'); } function appendInputHidden($name, $value) {