I wanted to have a dynamic link to reload @DIRECTORY TV-values after
uploading photos with @alik’s photocrop.
This works for editing extisting resources AND creating new ones.
In EVO > 102 just clicking "save" is a way better option, as unsaved data get lost.
//Good sample code for UI messages etc.
$reloadUrl = htmlspecialchars_decode($_SERVER['QUERY_STRING']);
$reloadLink = '<a href="index.php?' . $reloadUrl . '">Reload Resource!</a>';
$e = &$modx->Event;
switch($e->name) {
case 'OnDocFormRender':
echo '<div class="sectionBody"><h3>' . $reloadLink . ' (All unsaved data will be lost!)</h3></div>';
break;
default:
return;
break;
}