-
-
Save sprklinginfo/599fc208a3e4ed70b15e to your computer and use it in GitHub Desktop.
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 | |
/* | |
They're stored in the COLLECTION_POLICY datastream, on the collection object. You can use the | |
CollectionPolicy class (https://github.com/Islandora/islandora_solution_pack_collection/blob/7.x/includes/collection_policy.inc) | |
to help parse this datastream, in particular, the getContentModels() method | |
(https://github.com/Islandora/islandora_solution_pack_collection/blob/7.x/includes/collection_policy.inc#L75-L105)should be of use to you. | |
Could probably use some error handling, but something like this: https://gist.github.com/adam-vessey/731c415cf822dd9f9f65 | |
*/ | |
// Load the collection object. | |
$object = islandora_object_load('the:pid'); | |
// Instantiate a CollectionPolicy object with our policy. | |
$collection_policy = new CollectionPolicy($object['COLLECTION_POLICY']->content); | |
// Grab the models. | |
$models = $collection_policy->getContentModels(); | |
// Grab the desired namespace. | |
// For sanity, may want to pass this through islandora_get_namespace(), as we've not always | |
// written only the namespace itself... Occasionally, it may look like a full PID.: | |
// @see https://github.com/Islandora/islandora/blob/fd95c8dce72a8c6fbb7e36021b448781a3055909/includes/utilities.inc#L256-L276 | |
$namespace = $models['the:relevantCModel']['namespace']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment