Skip to content

Instantly share code, notes, and snippets.

@bwente
Last active August 29, 2015 14:19
Show Gist options
  • Save bwente/4ddd6c90e7e0c0fb540a to your computer and use it in GitHub Desktop.
Save bwente/4ddd6c90e7e0c0fb540a to your computer and use it in GitHub Desktop.
Takes a string of resource ids and filters out the unpublished resources.
<?php
$linkArray = explode(',', $input);
foreach ($linkArray as $key => $resource ) {
$page = $modx->getObject('modResource', $resource);
$published = $page->get('published');
if ($published){
$publishedArray[] = $resource;
}
}
$publishedList = implode(",", $publishedArray);
return $publishedList;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment