Help texts for language strings are gone since XH 1.6

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Help texts for language strings are gone since XH 1.6

Post by cmb » Mon Jul 14, 2014 9:03 pm

Hello Community,

I've just noticed, that the help texts for language strings are not available anymore since CMSimple_XH 1.6. I'm not sure, whether that is a good thing (consider a config option and a language string with the same name), or whether it has to be regarded as a regression bug.

Basically, I don't see the need for help texts for localizations (except for something like Filebrowser: properly escape JS config options, but in this case there are better alternatives). There are, however, plugins that use language strings that are actually configuration options, and it might be reasonable to allow respective help texts.

What do you think? If it's a bug, we should fix it as soon as possible, i.e. for XH 1.6.3.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: Help texts for language strings are gone since XH 1.6

Post by Holger » Tue Jul 15, 2014 7:28 am

Hmm, to be honest, I've never really noticed that there's the possibility to have tooltips... :o ...
cmb wrote:What do you think?
If it's not a big problem, it should be fixed IMO. For some plugins it seems to be useful (RSS-Settings in AdvancedNews / RealBlog for example). But it's not a "must be".

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Help texts for language strings are gone since XH 1.6

Post by cmb » Tue Jul 15, 2014 9:19 am

Holger wrote:Hmm, to be honest, I've never really noticed that there's the possibility to have tooltips... :o ...
I'm not sure, if this possibility was intended, when the tooltips have been introduced.
Holger wrote:If it's not a big problem, it should be fixed IMO.
No, it's not a big problem. Actually, the following patch should suffice:

Code: Select all

Index: FileEdit.php
===================================================================
--- FileEdit.php	(revision 1314)
+++ FileEdit.php	(working copy)
@@ -953,7 +953,9 @@
                 if ($cat == 'meta' && $name =='codepage') {
                     continue;
                 }
-                $co = array('val' => $val, 'type' => 'text');
+                $hint = isset($tx['help']["${cat}_$name"])
+                    ? $tx['help']["${cat}_$name"] : null;
+                $co = array('val' => $val, 'type' => 'text', 'hint' => $hint);
                 if ($cat == 'subsite' && $name == 'template') {
                     if ($sl === $cf['language']['default']) {
                         $co['type'] = 'hidden';
@@ -1131,7 +1133,9 @@
         $this->cfg = array();
         foreach ($plugin_tx[$plugin] as $key => $val) {
             list($cat, $name) = $this->splitKey($key);
-            $co = array('val' => $val, 'type' => 'text');
+            $hint = isset($plugin_tx[$plugin]["cf_$key"])
+                ? $plugin_tx[$plugin]["cf_$key"] : null;
+            $co = array('val' => $val, 'type' => 'text', 'hint' => $hint);
             $this->cfg[$cat][$name] = $co;
         }
     }
However, I noticed that this will add a tooltip to $tx[mailform][captcha], which is somewhat irritating. Maybe it would be better to check for tx_ prefixes instead of cf_. :?
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply