Last active
August 29, 2015 14:19
-
-
Save bwente/4ddd6c90e7e0c0fb540a to your computer and use it in GitHub Desktop.
Takes a string of resource ids and filters out the unpublished resources.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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