Browse Source

Merge pull request #140 from jmacwilliams/6.x

islandora now calls out to modules to alter the collection query
pull/142/head
Jonathan Green 13 years ago
parent
commit
d30efed3be
  1. 10
      CollectionClass.inc
  2. 5
      api/fedora_item.inc

10
CollectionClass.inc

@ -34,12 +34,12 @@ class CollectionClass {
} }
public static function getCollectionQuery($pid) { public static function getCollectionQuery($pid) {
if ($query = self::getCollectionQueryFromStream($pid)) { $query = self::getCollectionQueryFromStream($pid);
return $query; if (!$query) {
} $query = self::getDefaultCollectionQuery($pid);
else {
return self::getDefaultCollectionQuery($pid);
} }
drupal_alter("islandora_collection_query", $query, $pid);
return $query;
} }
protected static function getCollectionQueryFromStream($pid) { protected static function getCollectionQueryFromStream($pid) {

5
api/fedora_item.inc

@ -347,7 +347,10 @@ RDF;
$modified = FALSE; $modified = FALSE;
$rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship); $rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship);
if (!empty($rels)) { if (!empty($rels)) {
foreach ($rels as $rel) { // iterate backwards so if we delete something our pointer doesn't get out of sync
for ($i = $rels->length; $i>0; $i--) {
$rel = $rels->item($i-1);
// foreach ($rels as $rel) { // moving forward like this caused iteration errors when something was deleted
if ( //If either no object is specified, or the object matches (in either the literal or URI case), remove this node from it's parent, and mark as changed. if ( //If either no object is specified, or the object matches (in either the literal or URI case), remove this node from it's parent, and mark as changed.
empty($object) || empty($object) ||
(($literal_value == RELS_TYPE_URI) && $rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) || (($literal_value == RELS_TYPE_URI) && $rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) ||

Loading…
Cancel
Save