Within a weblink-resource the target-link in the content-field (*content) needs to be surrounded by modx-link-syntax:
If there is only the id as numeral and friendly-url-setting is on I got 404-error - is it the expected behaviour?
When dragging and dropping a resource into the content-field of a weblink-resource the id became a numeral without the link-syntax and so it produces the error.
I wrote a little plugin that looks for numerals in the content-field of the currently edited weblink-resources and surround those with the link-syntax with the event onBeforDocFormSave. The change in the content-field you see not before reopen the resource but its done anyway.
<?php
$myClassKey = $resource->get('class_key');
$myContent = $resource->get('content');
if (($myClassKey == 'modWebLink') && (is_numeric($myContent))) {
$resource->set('content','[[~'.$myContent.']]');
$resource->save();
}
?>
Is there any other, better or modx-conformer way to do so?
Thanks in advance!
Rainer
--
using MODX Revolution 2.2.4-pl (advanced)