diff --git a/Classes/Utility/InitialMarker.php b/Classes/Utility/InitialMarker.php
new file mode 100644
index 00000000..4112d3eb
--- /dev/null
+++ b/Classes/Utility/InitialMarker.php
@@ -0,0 +1,70 @@
+, in2code.de
+ *
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+
+/**
+ * Class to extend Pi1 field marker e.g. {firstname}
+ *
+ * @package powermail
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ *
+ */
+class Tx_Powermail_Utility_InitialMarker {
+
+ /**
+ * Initialy filling of marker field
+ *
+ * @param string $status mode of change
+ * @param string $table the table which gets changed
+ * @param string $id uid of the record
+ * @param array $fieldArray the updateArray
+ * @param array $this obj
+ * @return an updated fieldArray()
+ */
+ public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) {
+ if ($table != 'tx_powermail_domain_model_fields') { // stop if not powermail field table
+ return $fieldArray;
+ }
+ if (!empty($fieldArray['marker'])) { // stop if marker field is already filled
+ return $fieldArray;
+ }
+ $fieldArray['marker'] = $this->cleanString($fieldArray['title']);
+ }
+
+ /**
+ * Clean Marker String ("My Field" => "my_field")
+ *
+ * @param string $string Any String
+ * @return string
+ */
+ private function cleanString($string) {
+ $string = preg_replace('/[^a-zA-Z0-9_-]/', '', $string);
+ $string = str_replace(array('-'), '_', $string);
+ $string = strtolower($string);
+ return $string;
+ }
+}
+?>
\ No newline at end of file
diff --git a/Classes/Utility/Marker.php b/Classes/Utility/Marker.php
index 2da57de7..46779bda 100644
--- a/Classes/Utility/Marker.php
+++ b/Classes/Utility/Marker.php
@@ -26,7 +26,7 @@
/**
- * Class to extend Pi1 field marker
+ * Class to extend Pi1 field marker e.g. {firstname}
*
* @package powermail
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
@@ -43,9 +43,9 @@ class Tx_Powermail_Utility_Marker {
*/
public function createMarker($PA, $fobj) {
$content = '';
- if (isset($PA['row']['marker']) && !empty($PA['row']['marker'])) {
+ if (isset($PA['row']['marker']) && !empty($PA['row']['marker'])) { // if entry in db
$marker = $PA['row']['marker'];
- } else {
+ } else { // no entry
$marker = $PA['row']['title'];
}
$marker = preg_replace('/[^a-zA-Z0-9_-]/', '', $marker);
@@ -67,7 +67,7 @@ public function createMarker($PA, $fobj) {
}
/**
- * Workarround to only show a label and no field
+ * Workarround to only show a label and no field in TCA
*
* @param array Config Array
* @param object Parent Object
diff --git a/Resources/Private/Language/locallang_db.xml b/Resources/Private/Language/locallang_db.xml
index 5035fc6e..a7b2c3e6 100644
--- a/Resources/Private/Language/locallang_db.xml
+++ b/Resources/Private/Language/locallang_db.xml
@@ -84,7 +84,7 @@
-
+
@@ -234,7 +234,7 @@
-
+
diff --git a/ext_localconf.php b/ext_localconf.php
index eeda4340..0b4e5303 100644
--- a/ext_localconf.php
+++ b/ext_localconf.php
@@ -46,6 +46,12 @@
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$_EXTKEY . '_pi1'][$_EXTKEY] =
'EXT:' . $_EXTKEY . '/Classes/Utility/PluginInfo.php:Tx_Powermail_Utility_PluginInfo->getInfo';
+/**
+ * Hooking for first fill of marker field in backend
+ */
+$GLOBALS ['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] =
+ 'EXT:' . $_EXTKEY . '/Classes/Utility/InitialMarker.php:Tx_Powermail_Utility_InitialMarker';
+
/**
* Extra evaluation of TCA fields
*/
diff --git a/todos.txt b/todos.txt
index 7b12a42d..f3c542aa 100644
--- a/todos.txt
+++ b/todos.txt
@@ -12,7 +12,7 @@ x backend module reporting fields
x backend module reporting marketing
x backend check (session is working, etc...)
o dynamic field preview
-o Bugfix Marker Backend
+=> Bugfix Marker Backend
x prefill
x all fields marker
x validation js