public function getViews() { $aryViews = array(); $views_xml = XmlHelper::xpath($this->xml->ownerDocument, "/content/options/placeholders/descendant::placeholder[@name='{$this->name}']/descendant::view"); foreach ($views_xml as $view_xml) { $aryViews[] = new View($view_xml->getAttribute("path"), $view_xml); } return $aryViews; }
public function delete($page) { // delete node $xml_parent = XmlHelper::xpath($this->xml, "/order/pages"); $xml_parent = $xml_parent->item(0); $node = $this->getNode($page); if ($node != null) { $xml_parent->removeChild($node); } }
public function getField($field) { $fields = XmlHelper::xpath($this->xml, "/type/fields/field[@name='{$field}']"); $node_field = $fields->item(0); if ($node_field == null) { $node_field = $this->xml->createElement("field"); $node_field->setAttribute("name", $field); $node_field->appendChild($this->xml->createElement("type", "string")); $node_field->appendChild($this->xml->createElement("description", "")); $xml_parent = XmlHelper::xpath($this->xml, "/type/fields"); $xml_parent->item(0)->appendChild($node_field); } return new ContentTypeField($node_field); }
public function getPlaceHolder($name) { $name = strToLower($name); if (!array_key_exists($name, $this->aryPlaceholders)) { $placeholder_xml = XmlHelper::xpath($this->xml, "/content/options/placeholders/descendant::placeholder[@name='{$name}']"); // add / pick up placeholder if ($placeholder_xml->item(0) == null) { $node_placeholder = $this->xml->createElement("placeholder"); $node_placeholder->setAttribute("name", $name); $node_parent = XmlHelper::xpath($this->xml, "/content/options/placeholders"); $node_parent->item(0)->appendChild($node_placeholder); $node = $node_placeholder; } else { $node = $placeholder_xml->item(0); } $this->aryPlaceholders[$name] = new PlaceHolder($name, $node); } return $this->aryPlaceholders[$name]; }