Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

re-implement rex_form addRawField() method from r4 #55

Merged
merged 3 commits into from

2 participants

@jdlx

No description provided.

@gharlan
Owner

@jdlx Fehlt hier nicht noch dieses isRawElement()? redaxo/redaxo4@e35dd92

@jdlx

hast recht.. ja.. fix ich..

@jdlx

fixed ..

@gharlan gharlan merged commit 056abf8 into redaxo:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2012
  1. @jdlx

    add method addRawField()

    jdlx authored
  2. @jdlx

    add class rex_form_raw_element

    jdlx authored
Commits on Apr 10, 2012
  1. @jdlx

    add method isRawElement()

    jdlx authored
This page is out of date. Refresh to see the latest.
View
29 redaxo/src/core/lib/form/elements/raw.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * class implements storage of raw html(string) as rex_form object
+ */
+class rex_form_raw_element extends rex_form_element
+{
+ private $html;
+
+ public function __construct($html = '')
+ {
+ $this->html = $html;
+ }
+
+ public function formatElement()
+ {
+ return $this->html;
+ }
+
+ public function get()
+ {
+ return $this->html;
+ }
+
+ public function wrapContent()
+ {
+ return $this->html;
+ }
+}
View
22 redaxo/src/core/lib/form/form.php
@@ -433,6 +433,16 @@ public function addControlField($saveElement = null, $applyElement = null, $dele
}
/**
+ * Fuegt dem Formular beliebiges HTML zu.
+ * @param string $html HTML code
+ */
+ public function addRawField($html)
+ {
+ $field = $this->addElement(new rex_form_raw_element($html));
+ return $field;
+ }
+
+ /**
* Fuegt dem Formular eine Fehlermeldung hinzu.
*/
public function addErrorMessage($errorCode, $errorMessage)
@@ -766,6 +776,17 @@ protected function isControlElement(rex_form_element $element)
return is_a($element, 'rex_form_control_element');
}
+
+ /**
+ * @param rex_form_element $element
+ *
+ * @return boolean
+ */
+ protected function isRawElement(rex_form_element $element)
+ {
+ return is_a($element, 'rex_form_raw_element');
+ }
+
/**
* @return array
*/
@@ -859,6 +880,7 @@ protected function getSaveElements()
foreach($fieldsetElementsArray as $key => $element)
{
if($this->isFooterElement($element)) continue;
+ if($this->isRawElement($element)) continue
// PHP4 compat notation
$fieldsetElements[$fieldsetName][] = $this->elements[$fieldsetName][$key];
Something went wrong with that request. Please try again.