/**
  * Generates HTML output for the given area object and its child elements
  *
  * @internal
  * @param Area $objField The Area object to parse
  * @param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false.
  * @param integer $intDynamicCount The dynamic counter for the current area being parsed
  * @return string Generated HTML
  */
 private function areaAsHtml($objField, $hideEmpty = false, $intDynamicCount = 0)
 {
     $strReturn = "";
     $strSet = "";
     if ($objField->hasContent($intDynamicCount)) {
         foreach ($objField->getFields() as $objSubField) {
             if (get_class($objSubField) !== "ValidFormBuilder\\Paragraph") {
                 switch (get_class($objSubField)) {
                     case "ValidFormBuilder\\MultiField":
                         $strSet .= $this->multiFieldAsHtml($objSubField, $hideEmpty, $intDynamicCount);
                         break;
                     default:
                         $strSet .= $this->fieldAsHtml($objSubField, $hideEmpty, $intDynamicCount);
                         // Support nested dynamic fields.
                         if ($objSubField->isDynamic()) {
                             $intDynamicCount = $objSubField->getDynamicCount();
                             for ($intCount = 1; $intCount <= $intDynamicCount; $intCount++) {
                                 $strSet .= $this->fieldAsHtml($objSubField, $hideEmpty, $intCount);
                             }
                         }
                 }
             }
         }
     }
     $strLabel = $objField->getShortLabel();
     if (!empty($strSet)) {
         if (!empty($strLabel)) {
             $strReturn = "<tr>";
             $strReturn .= "<td colspan=\"3\" style=\"white-space:nowrap\" class=\"vf__area_header\">";
             $strReturn .= "<h3>{$strLabel}</h3>";
             $strReturn .= "</td>\n";
             $strReturn .= "</tr>";
         }
         $strReturn .= $strSet;
     } else {
         if (!empty($this->__novaluesmessage) && $objField->isActive()) {
             $strReturn = "<tr>";
             $strReturn .= "<td colspan=\"3\" style=\"white-space:nowrap\" class=\"vf__area_header\">";
             $strReturn .= "<h3>{$strLabel}</h3>";
             $strReturn .= "</td>\n";
             $strReturn .= "</tr>";
             return $strReturn . "<tr><td colspan=\"3\">{$this->__novaluesmessage}</td></tr>";
         } else {
             return "";
         }
     }
     return $strReturn;
 }
 /**
  * Add an area to the internal elements collection.
  *
  * See {@link \ValidFormBuilder\Area} for examples
  *
  * @param string $label The title of this area
  * @param string $active If `true`, the title has a checkbox which can enable or disable all child elements
  * @param string $name The ID of this area
  * @param string $checked Use in combination with `$active`; if `true`, the checkbox will be checked by default
  * @param array $meta The meta array
  *
  * @return \ValidFormBuilder\Area
  */
 public function addArea($label = null, $active = false, $name = null, $checked = false, $meta = array())
 {
     $objArea = new Area($label, $active, $name, $checked, $meta);
     $objArea->setRequiredStyle($this->__requiredstyle);
     // *** Fieldset already defined?
     $objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
     if ($this->__elements->count() == 0 || !is_object($objFieldset)) {
         // No fieldset found in the elements collection, add a fieldset.
         $objFieldset = $this->addFieldset();
     }
     $objArea->setMeta("parent", $objFieldset, true);
     // *** Add field to the fieldset.
     $objFieldset->addField($objArea);
     return $objArea;
 }