/** * The place to check if the data set in the snippet is valid * to generate the snippet. * * When invalid data should result in an error, you can throw it * here but you can also perform the check in the * checkRegistryRequestsAnswers() function from the * {@see \MUtil_Registry_TargetInterface}. * * @return boolean */ public function hasHtmlOutput() { if (!$this->repeater) { $this->repeater = \MUtil_Lazy::repeat($this->data); } else { // We do not know whether there is any link between // the data and the repeater, so do not use the data $this->data = null; } // If onEmpty is set, we alwars have output if ($this->onEmpty) { return true; } // Is there any data in the repeater? return $this->repeater->__start(); }
/** * Function to allow overloading of content rendering only * * The $view is used to correctly encode and escape the output * * @param \Zend_View_Abstract $view * @return string Correctly encoded and escaped html output */ protected function renderContent(\Zend_View_Abstract $view) { $renderer = \MUtil_Html::getRenderer(); if ($this->_content) { if ($this->_repeater && !$this->_repeatTags) { if ($this->_repeater->__start()) { $html = ''; while ($this->_repeater->__next()) { $html .= $renderer->renderArray($view, $this->_content); } return $html; } } else { $content = $renderer->renderArray($view, $this->_content); if (strlen($content)) { return $content; } } } if ($this->_onEmptyContent) { return $renderer->renderArray($view, $this->_onEmptyContent); } return null; }