Example #1
0
 /**
  * Allocates member variables of currentElement or can be used for subfields.
  * Parses for default values and the possibility of edit and make it public.
  * @param DOMElement $field
  * @param Publish_Model_FormElement $subfield
  * @return false if there are no child nodes
  */
 private function _parseDefaultEntry($currentElement, DOMElement $field, Publish_Model_FormElement $subfield = null)
 {
     if ($field->hasChildNodes()) {
         foreach ($field->getElementsByTagname('default') as $default) {
             if ($default->hasAttributes()) {
                 $defaultArray = array();
                 $forValue = $default->getAttribute('for');
                 if (isset($forValue)) {
                     $defaultArray['for'] = $forValue;
                 }
                 $value = $default->getAttribute('value');
                 if (isset($value)) {
                     $defaultArray['value'] = $value;
                 }
                 $edit = $default->getAttribute('edit');
                 if (isset($edit)) {
                     $defaultArray['edit'] = $edit;
                 }
                 $public = $default->getAttribute('public');
                 if (isset($public)) {
                     $defaultArray['public'] = $public;
                 }
                 if (!isset($subfield)) {
                     $currentElement->setDefaultValue($defaultArray);
                     $this->log->debug(__METHOD__ . " : " . $value);
                 } else {
                     $subfield->setDefaultValue($defaultArray);
                 }
             } else {
                 return false;
             }
         }
     }
 }