Hello,
I’m creating a basic plugin that generates an images with the title of the content when the content is saved, but I have a problem retrieving the parameters when the event ( OnDocFormSave ) is executed.
Searching in modx website, wiki, api, forums and google I found how to get the ID but not the Page title.
Can you tell me where is the pagetitle? Where is it documented? Because I cannot find that
Thanks!
EDITED: I solved that using $_POST[’pagetitle’] but, is this a good way? Can I do that using the API?
Here is the code:
$imagesFolder="/home/page/images/titulosNoticias/";
$e = $modx->Event;
$contentID=$e->params['id']; //It's OK
$contentTitle=$e->params->documentObject['pagetitle']; //Doesn't Work.
//$contentTitle=$e->params['pagetitle']; //Doesn't Work too.
$im = imagecreatefrompng($imagesFolder."vacio.png");
$blue = imagecolorallocate($im, 0, 0, 124);
imagettftext($im,20,1.5,71,51,$blue,$imagesFolder."DIEDIEDI.TTF",strtoupper($contentTitle));
imagesavealpha($im, true);
imagepng($im,$imagesFolder."titulo_".$contentID.".png");
imagedestroy($im);