/**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     if ($this->isValid()) {
         return $template->createTextNode($this->getDisplayValue());
     } else {
         return $template->createTextNode('');
     }
 }
示例#2
0
 /**
  * Process the header of an editable node
  * @param I2CE_Template $template
  * @param DOMNode $node
  * @param DOMNode $head_node
  */
 protected function processHeaderEditable($template, $node, $head_node)
 {
     if ($this->getOption('required')) {
         $asterisk = $template->createElement("span");
         $asterisk->appendChild($template->createTextNode("*"));
         $asterisk->setAttribute("class", "required_field_notice");
         $head_node->appendChild($asterisk);
         $head_node->setAttribute("class", $head_node->getAttribute("class") . " required_field");
     }
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node  
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     if ($this->container instanceof I2CE_Form) {
         $link_node = $template->createElement('a', array("href" => $this->getLink()), $this->getDisplayValue());
         return $link_node;
     } else {
         return $template->createTextNode($this->getDisplayValue());
     }
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @return DOMNode
  */
 public function getDisplayNode($node, $template)
 {
     $text = $this->getDisplayValue();
     $link = $this->getLink();
     if (!$link || strlen($this->value) == 0) {
         //there is no linked URL to this field so we just display the text
         return $template->createTextNode($text);
     }
     $link_node = $template->createElement('a', array('href' => $link));
     while ($node->hasChildNodes()) {
         $link_node->appendChild($node->firstChild);
     }
     if ($node->hasAttribute('show_text') && (strtolower($node->getAttribute('show_text')) == 'true' || strtolower($node->getAttribute('show_text')) == '!false')) {
         $link_node->appendChild($template->createTextNode($text));
     }
     if (!$node->hasAttribute('show_image') || strtolower($node->getAttribute('show_image')) == 'true' || strtolower($node->getAttribute('show_image')) == '!false') {
         $width = null;
         $height = null;
         if ($node->hasAttribute('height')) {
             $height = $node->getAttribute('height');
             $node->removeAttribute('height');
         }
         if ($node->hasAttribute('width')) {
             $width = $node->getAttribute('width');
             $node->removeAttribute('width');
         }
         $attrs = array("src" => $link, 'alt' => $text, 'class' => 'field_image');
         if (!empty($width)) {
             $attrs['width'] = $width;
         }
         if (!empty($height)) {
             $attrs['height'] = $height;
         }
         $link_node->appendChild($template->createElement('img', $attrs));
     }
     return $link_node;
 }
 /**
  * Return the display value of this form field as a DOM Node.
  * @param DOMNode $node
  * @param I2CE_Template $template
  * @param string $style.  Defaults to 'default'
  * @return DOMNode
  */
 public function _getDisplayNode($node, $template, $style = 'default')
 {
     $text_node = $template->createTextNode($this->_getDisplayValue($style));
     if ($href = $this->getHref()) {
         $link_node = $template->createElement("a", array("href" => $href));
         $link_node->appendChild($text_node);
         return $link_node;
     } else {
         return $text_node;
     }
 }