Browse Source

Content Model can now list form names, updated islandoracm.xsd to reflex the new form structure.

pull/105/head
Nigel Banks 14 years ago
parent
commit
a0d16be879
  1. 20
      ContentModel.inc
  2. 14
      islandoracm.xsd

20
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;
}
}

14
islandoracm.xsd

@ -344,20 +344,22 @@
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="parent_path">
<xsd:element name="parent_path" minOccurs="0">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:normalizedString">
<xsd:attribute name="force_create_if_not_found"
type="xsd:boolean" use="required"/>
</xsd:extension>
<xsd:extension base="xsd:normalizedString"> </xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="xml" type="xsd:normalizedString"/>
<xsd:choice>
<xsd:element name="xml" type="xsd:normalizedString"/>
<xsd:element name="element" type="xsd:normalizedString"/>
<xsd:element name="attribute" type="xsd:normalizedString"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="require_value" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

Loading…
Cancel
Save