Skip to content

Instantly share code, notes, and snippets.

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