modResource.getPreviewUrl
Last updated not available | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moremodResource.getPreviewUrl¶
Returns the URL behind the manager's Preview button. For a plain document the method calls modX::makeUrl() for this Resource. Symlinks must hold an integer target. Weblinks may hold an ID, a [[~id]] tag, a link tag with options, or an external URL. The ID variants are validated with canPreviewResource().
An empty string comes back for a deleted Resource, an empty or invalid link, or a target failing the check; null is never returned. When the context has sessions disabled, the URL gets a preview=true query parameter. The call has a side effect: the cache_alias_map option is switched off for the rest of the request.
Syntax¶
string getPreviewUrl ()
Example¶
$resource = $modx->getObject('modResource', array('id' => 5));
$url = $resource->getPreviewUrl();
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










