[FEATURE] Allow placeholder attribute with stdWrap support 38/32738/10
authortritum_rz <ralf.zimmermann@tritum.de>
Fri, 12 Sep 2014 09:26:09 +0000 (11:26 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 15 Jul 2015 20:23:29 +0000 (22:23 +0200)
Resolves: #61308
Releases: master
Change-Id: Id3a2625d91a821c09865d73c426559ae02bf975e
Reviewed-on: http://review.typo3.org/32738
Reviewed-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Stefan Froemken <froemken@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Documentation/Changelog/master/Feature-61308-AllowPlaceholderAttribute.rst [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attribute/PlaceholderAttribute.php [new file with mode: 0755]
typo3/sysext/form/Classes/Domain/Model/Element/TextlineElement.php [changed mode: 0644->0755]

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-61308-AllowPlaceholderAttribute.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-61308-AllowPlaceholderAttribute.rst
new file mode 100644 (file)
index 0000000..1b2370b
--- /dev/null
@@ -0,0 +1,10 @@
+=============================================
+Feature: #61308 - Allow Placeholder attribute
+=============================================
+
+Description
+===========
+
+System extension ``form`` allows a placeholder attribute in textfields
+by adding it in a form configuration. However, there is no option to add
+placeholder using the form wizard, yet.
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attribute/PlaceholderAttribute.php b/typo3/sysext/form/Classes/Domain/Model/Attribute/PlaceholderAttribute.php
new file mode 100755 (executable)
index 0000000..aae4855
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+namespace TYPO3\CMS\Form\Domain\Model\Attribute;
+
+/**
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Attribute 'placeholder'
+ */
+class PlaceholderAttribute extends AbstractAttribute {
+
+       /**
+        * Gets the attribute 'placeholder'.
+        * Used with textline element
+        *
+        * This attribute assigns a placeholder to an element.
+        *
+        * @return string Attribute value
+        */
+       public function getValue() {
+               return (string)$this->value;
+       }
+
+       /**
+        * Set the value
+        *
+        * @param mixed $value The value to set
+        * @return void
+        */
+       public function setValue($value) {
+               if (is_string($value)) {
+                       $this->value = $value;
+               } elseif (is_array($value)) {
+                       $this->value = $this->localCobj->cObjGetSingle('TEXT', $value);
+               } else {
+                       $this->value = '';
+               }
+       }
+}
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index cb4aa90..2debd09
@@ -40,7 +40,8 @@ class TextlineElement extends \TYPO3\CMS\Form\Domain\Model\Element\AbstractEleme
                'tabindex' => '',
                'title' => '',
                'type' => 'text',
-               'value' => ''
+               'value' => '',
+               'placeholder' => '',
        );
 
        /**