|
From: | Doursenaud , Raphaël |
Subject: | Re: [Dolibarr-dev] extrafields label |
Date: | Fri, 23 May 2014 15:17:05 +0200 |
Finally , i have found a way to skirt the problem with some jquery and a hook; i give you the code below if you face the same problem :
function formObjectOptions($parameters, $object, $action)
{
// translate extrafields labels
print '<script type="text/_javascript_">
$(document).ready(function() {
$("input[name^=options_").each(function() {
var labelCell = $(this).parent("td").prev("td");
// get the translation with an ajax call
$.get("'.dol_buildpath('/mymodule/',1).'ajax/translate.php", {text: $(labelCell).text(), langfile: "address@hidden"}, function(data) { $(labelCell).html(data); }, "html");
});
});
</script>';
...
}
and here is the ajax translate.php program :
<?php
address@hidden("../../main.inc.php"); // For root directory
if (! $res) address@hidden("../../../main.inc.php"); // For "custom" directory
$langfile = GETPOST('langfile');
$text = GETPOST('text');
$langs->load($langfile);
print $langs->trans($text);
?>
Le 23/05/2014 14:39, Philippe Grand a écrit :
Le 23/05/2014 14:35, Florian HENRY a écrit :
About that extrafield define and use by extranal module it can be nice to be able to define them into module descriptor rather than play with SQL request to create them, but it's another story.I rather see what you mean ;-)
and agree one hundred times with you
_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
[Prev in Thread] | Current Thread | [Next in Thread] |