diff --git a/ContentModel.inc b/ContentModel.inc index 5ed33d59..8f0d1df5 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -2013,4 +2013,24 @@ class ContentModel extends XMLDatastream { } return $ret; } + + /** + * + * @return array + * An array of form names that exist in this content model. + */ + public function getFormNames() { + if (!$this->validate()) { + return FALSE; + } + $xpath = new DOMXPath($this->xml); + $xpath->registerNamespace('cm', 'http://www.islandora.ca'); + $result = $xpath->query('//cm:forms/cm:form/@name'); // Select the name attribute of all forms. + for($i = 0; $i < $result->length; $i++) { + $attribute = $result->item($i); + $name = $attribute->value; + $names[$name] = $name; + } + return $names; + } } diff --git a/islandoracm.xsd b/islandoracm.xsd index 89d44f46..d199d8ee 100644 --- a/islandoracm.xsd +++ b/islandoracm.xsd @@ -344,20 +344,22 @@ - + - - - + - + + + + + +