Created
December 5, 2014 22:41
-
-
Save adam-vessey/731c415cf822dd9f9f65 to your computer and use it in GitHub Desktop.
Example of acquiring the namepace from a collection object in Islandora
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 | |
// 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