[BUGFIX] Indexed Search: Bring back html5 placeholder 20/45220/5
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Fri, 11 Dec 2015 23:58:25 +0000 (00:58 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Sat, 12 Dec 2015 21:26:49 +0000 (22:26 +0100)
The placeholder for the search box of the AbstractPlugin
based plugin was removed by accident in
https://review.typo3.org/6657

This change brings it back.

Resolves: #68381
Releases: master
Change-Id: If876c204b305d6cc67f27fed5a3ca29a894c4b99
Reviewed-on: https://review.typo3.org/45220
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/indexed_search/Classes/Controller/SearchFormController.php
typo3/sysext/indexed_search/Resources/Private/Templates/indexed_search.tmpl
typo3/sysext/indexed_search/Resources/Private/Templates/template_css.tmpl

index 0672a1b..22a853c 100755 (executable)
@@ -1359,7 +1359,18 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
         }
         $markerArray['###FORM_SUBMIT###'] = $this->pi_getLL('submit_button_label', '', true);
         // Adding search field value
-        $markerArray['###SWORD_VALUE###'] = htmlspecialchars($this->piVars['sword']);
+        $markerArray['###SWORD_VALUE###'] = '';
+        $markerArray['###PLACEHOLDER###'] = '';
+        if (!empty($this->piVars['sword'])) {
+            $markerArray['###SWORD_VALUE###'] = htmlspecialchars($this->piVars['sword']);
+        } else {
+            // Add a HTML5 placeholder attribute if the configured doctype allows it
+            if ($GLOBALS['TSFE']->config['config']['doctype'] === 'html5') {
+                $markerArray['###PLACEHOLDER###'] = 'placeholder="' . $this->pi_getLL('default_search_word_entry') . '"';
+            } else {
+                $markerArray['###SWORD_VALUE###'] = $this->pi_getLL('default_search_word_entry');
+            }
+        }
         // Additonal keyword => "Add to current search words"
         if ($this->conf['show.']['clearSearchBox'] && $this->conf['show.']['clearSearchBox.']['enableSubSearchCheckBox']) {
             $markerArray['###SWORD_PREV_VALUE###'] = htmlspecialchars($this->conf['show.']['clearSearchBox'] ? '' : $this->piVars['sword']);
index 70fb1a8..4776dc7 100644 (file)
@@ -26,7 +26,7 @@
        <table cellpadding="0" cellspacing="0" border="0" summary="Search form">
                <tr>
                        <td>###FORM_SEARCHFOR###</td>
-                       <td colspan="2"><input type="search" name="tx_indexedsearch[sword]" value="###SWORD_VALUE###" class="tx-indexedsearch-searchbox-sword sword" /></td>
+                       <td colspan="2"><input type="search" name="tx_indexedsearch[sword]" value="###SWORD_VALUE###" class="tx-indexedsearch-searchbox-sword sword" ###PLACEHOLDER### /></td>
                </tr>
 
                <!-- ###ADDITONAL_KEYWORD### begin -->
index 24de211..2cb0f45 100644 (file)
@@ -31,8 +31,7 @@
 
                <div class="tx-indexedsearch-form">
                        <label for="tx-indexedsearch-searchbox-sword">###FORM_SEARCHFOR###</label>
-                       <input type="search" name="tx_indexedsearch[sword]" value="###SWORD_VALUE###" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword sword" ###PLACEHOLDER#
-## />&nbsp;
+                       <input type="search" name="tx_indexedsearch[sword]" value="###SWORD_VALUE###" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword sword" ###PLACEHOLDER### />&nbsp;
                </div>
 
                <!-- ###ADDITONAL_KEYWORD### begin -->