Summary:
clic "run" action button in UDT with AceSyntax activated : = error
Detailed Description:
if in My account > user preferences
Select syntax highlighter to use = AceSyntax
and when Editing a User Defined Tags (with AceSyntax activate)
udt code example for testing error
-------------------------------------------------------------------------------
$gCms = \CmsApp::get_instance();
$db = $gCms->GetDb();
$mModifiedDate = trim($db->DBTimeStamp(time()), "'");
$query = "UPDATE ".CMS_DB_PREFIX."content SET modified_date=?";
$dbresult = $db->Execute($query, array($mModifiedDate));
if($dbresult)
{return 'update last modification date for all pages : Done';}
else{return 'oops, error ! ';}
------------------------------------------------------------------------------------------
on click "run" button
result : nothing append
and in console
javascript Uncaught TypeError: Cannot read properties of undefined (reading
'length')
this is due to the fact that the javascript in editusertag.tpl is waiting for id
"udtcode"
admin/templates/editusertag.tpl L11
----------------------------------------
var code = $('#udtcode').val();
----------------------------------------
but AceSyntax editor set id to "ace_editor0" on line 18 in
modules/AceSyntax/AdminSyntaxGenerateHeader.tpl
----------------------------------------
var textareaid = 'ace_editor' + index;
----------------------------------------
I solved the error like this while waiting for a better solution
modules/AceSyntax/AdminSyntaxGenerateHeader.tpl
----------------------------------------
var textareaid = 'ace_editor' + index;
const currentUrl = window.location.href;
if (currentUrl.includes('editusertag.php')) {
textareaid ='udtcode';
}
----------------------------------------
then it works.
also see in AceSyntax.module.php L54
Warning: Private methods cannot be final as they are never overridden by other
classes in
it was solved on svn but installing from module manager : error still exist
//private final function _autoloader($classname)
private function _autoloader($classname)