/**
  * Target of gform_field_content both on form editor & frontend.
  */
 public function get_field_content($field_content, $field, $force_frontend_label)
 {
     if (!isset($field_content) || !isset($field) || !array_key_exists('formId', $field)) {
         return $field_content;
     }
     // current field attributes
     $form_id = $field['formId'];
     $field_id = $field['id'];
     $input_type = isset($field['inputType']) && !empty($field['inputType']) ? $field['inputType'] : $field['type'];
     if ('html' === $input_type) {
         return $field_content;
     }
     $field_uid = $this->is_form_editor() ? "input_{$field_id}" : "input_{$form_id}_{$field_id}";
     // flag to check whether to process field placeholders
     $process_placeholders = $this->is_gravityforms_html5_enabled();
     $this->log("original field content", $field_content);
     // handle Field Content Encoding
     $encoding = mb_detect_encoding($field_content);
     if ($encoding != "UTF-8") {
         $field_content = mb_convert_encoding($field_content, 'UTF-8');
     }
     $field_content_wrapped = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /></head><body>{$field_content}</body></html>";
     // disable libxml error output while we are processing html
     $use_errors = libxml_use_internal_errors(true);
     // prepare DomDocument and XPath
     $doc = new DomDocument();
     $doc->preserveWhiteSpace = false;
     // needs to be before loading, to have any effect
     $doc->formatOutput = false;
     @$doc->loadHTML($field_content_wrapped);
     $xpath = new DOMXpath($doc);
     // process field label replacements
     if (isset($field['labelVisible']) && $field['labelVisible'] == false) {
         if ('section' === $input_type) {
             if ($h2 = ($result = $xpath->query("//h2[contains(@class,'gsection_title')]")) ? $result->item(0) : null) {
                 $styles = $h2->getAttribute('style');
                 $h2->setAttribute('style', trim("{$styles} display:none;"));
             }
         } else {
             if ($label = ($result = $xpath->query("//label[contains(@class,'gfield_label')]")) ? $result->item(0) : null) {
                 $styles = $label->getAttribute('style');
                 $label->setAttribute('style', trim("{$styles} display:none;"));
             }
         }
     }
     switch ($input_type) {
         case 'text':
         case 'textarea':
         case 'phone':
         case 'website':
         case 'number':
         case 'price':
         case 'post_title':
         case 'post_content':
         case 'post_excerpt':
             $lookup_type = 'textarea' === $input_type || 'post_content' === $input_type || 'post_excerpt' === $input_type ? 'textarea' : 'input';
             if ($process_placeholders && isset($field['placeholder']) && !empty($field['placeholder'])) {
                 if ($input = ($result = $xpath->query("//{$lookup_type}[@id='{$field_uid}']")) ? $result->item(0) : null) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                 }
             }
             break;
             // break text, textarea, phone, website, number, price, post_title, post_content, post_excerpt
         // break text, textarea, phone, website, number, price, post_title, post_content, post_excerpt
         case 'email':
             // process email
             if ($process_placeholders && isset($field['placeholder']) && !empty($field['placeholder'])) {
                 if ($this->is_form_editor() && ($input = ($result = $xpath->query("//input[@name='{$field_uid}']")) ? $result->item(0) : null)) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                 }
                 if ($input = ($result = $xpath->query("//input[@id='{$field_uid}']")) ? $result->item(0) : null) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                 }
             }
             if (isset($field['labelEnterEmail'])) {
                 if ($label = ($result = $xpath->query("//label[@for='{$field_uid}' and not(contains(@class,'gfield_label'))]")) ? $result->item(0) : null) {
                     $label->nodeValue = esc_html($field['labelEnterEmail']);
                 }
             }
             if (isset($field['labelEnterEmailVisible']) && $field['labelEnterEmailVisible'] == false) {
                 if ($label = ($result = $xpath->query("//label[@for='{$field_uid}' and not(contains(@class,'gfield_label'))]")) ? $result->item(0) : null) {
                     $styles = $label->getAttribute('style');
                     $label->setAttribute('style', trim("{$styles} display:none;"));
                 }
             }
             if (isset($field['emailConfirmEnabled']) && $field['emailConfirmEnabled']) {
                 // process confirm
                 if ($process_placeholders && isset($field['placeholderEmailConfirm']) && !empty($field['placeholderEmailConfirm'])) {
                     if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_2']")) ? $result->item(0) : null) {
                         $input->setAttribute('placeholder', esc_attr($field['placeholderEmailConfirm']));
                     }
                 }
                 if (isset($field['labelConfirmEmail'])) {
                     if ($label = ($result = $xpath->query("//label[@for='{$field_uid}_2']")) ? $result->item(0) : null) {
                         $label->nodeValue = esc_html($field['labelConfirmEmail']);
                     }
                 }
                 if (isset($field['labelConfirmEmailVisible']) && $field['labelConfirmEmailVisible'] == false) {
                     if ($label = ($result = $xpath->query("//label[@for='{$field_uid}_2']")) ? $result->item(0) : null) {
                         $styles = $label->getAttribute('style');
                         $label->setAttribute('style', trim("{$styles} display:none;"));
                     }
                 }
             }
             break;
             // break email
         // break email
         case 'name':
             $name_format = isset($field['nameFormat']) && !empty($field['nameFormat']) ? $field['nameFormat'] : 'normal';
             switch ($name_format) {
                 case 'simple':
                     if ($process_placeholders && isset($field['placeholder']) && !empty($field['placeholder'])) {
                         if ($input = ($result = $xpath->query("//input[@id='{$field_uid}']")) ? $result->item(0) : null) {
                             $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                         }
                     }
                     break;
                     // break simple
                 // break simple
                 case 'normal':
                 case 'extended':
                     // process name prefix
                     if ('extended' === $name_format) {
                         if ($process_placeholders && isset($field['placeholderNamePrefix']) && !empty($field['placeholderNamePrefix'])) {
                             if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_2']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderNamePrefix']));
                             }
                         }
                         if (isset($field['labelNamePrefix'])) {
                             if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_2_container']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelNamePrefix']);
                             }
                         }
                         if (isset($field['labelNamePrefixVisible']) && $field['labelNamePrefixVisible'] == false) {
                             if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_2_container']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         }
                     }
                     // process name first
                     if ($process_placeholders && isset($field['placeholderNameFirst']) && !empty($field['placeholderNameFirst'])) {
                         if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_3']")) ? $result->item(0) : null) {
                             $input->setAttribute('placeholder', esc_attr($field['placeholderNameFirst']));
                         }
                     }
                     if (isset($field['labelNameFirst'])) {
                         if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_3_container']/label")) ? $result->item(0) : null) {
                             $label->nodeValue = esc_html($field['labelNameFirst']);
                         }
                     }
                     if (isset($field['labelNameFirstVisible']) && $field['labelNameFirstVisible'] == false) {
                         if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_3_container']/label")) ? $result->item(0) : null) {
                             $styles = $label->getAttribute('style');
                             $label->setAttribute('style', trim("{$styles} display:none;"));
                         }
                     }
                     // process name last
                     if ($process_placeholders && isset($field['placeholderNameLast']) && !empty($field['placeholderNameLast'])) {
                         if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_6']")) ? $result->item(0) : null) {
                             $input->setAttribute('placeholder', esc_attr($field['placeholderNameLast']));
                         }
                     }
                     if (isset($field['labelNameLast'])) {
                         if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_6_container']/label")) ? $result->item(0) : null) {
                             $label->nodeValue = esc_html($field['labelNameLast']);
                         }
                     }
                     if (isset($field['labelNameLastVisible']) && $field['labelNameLastVisible'] == false) {
                         if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_6_container']/label")) ? $result->item(0) : null) {
                             $styles = $label->getAttribute('style');
                             $label->setAttribute('style', trim("{$styles} display:none;"));
                         }
                     }
                     // process name suffix
                     if ('extended' === $name_format) {
                         if ($process_placeholders && isset($field['placeholderNameSuffix']) && !empty($field['placeholderNameSuffix'])) {
                             if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_8']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderNameSuffix']));
                             }
                         }
                         if (isset($field['labelNameSuffix'])) {
                             if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_8_container']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelNameSuffix']);
                             }
                         }
                         if (isset($field['labelNameSuffixVisible']) && $field['labelNameSuffixVisible'] == false) {
                             if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_8_container']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         }
                     }
                     break;
                     // break normal & extended
             }
             // end switch name format
             break;
             // break name
         // break name
         case 'address':
             // process address line 1
             if ($process_placeholders && isset($field['placeholderAddressStreet']) && !empty($field['placeholderAddressStreet'])) {
                 if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_1']")) ? $result->item(0) : null) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholderAddressStreet']));
                 }
             }
             if (isset($field['labelAddressStreet'])) {
                 if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_1_container']/label")) ? $result->item(0) : null) {
                     $label->nodeValue = esc_html($field['labelAddressStreet']);
                 }
             }
             if (isset($field['labelAddressStreetVisible']) && $field['labelAddressStreetVisible'] == false) {
                 if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_1_container']/label")) ? $result->item(0) : null) {
                     $styles = $label->getAttribute('style');
                     $label->setAttribute('style', trim("{$styles} display:none;"));
                 }
             }
             // process address line 2
             if (!isset($field['hideAddress2']) || false === $field['hideAddress2']) {
                 if ($process_placeholders && isset($field['placeholderAddressStreet2']) && !empty($field['placeholderAddressStreet2'])) {
                     if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_2']")) ? $result->item(0) : null) {
                         $input->setAttribute('placeholder', esc_attr($field['placeholderAddressStreet2']));
                     }
                 }
                 if (isset($field['labelAddressStreet2'])) {
                     if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_2_container']/label")) ? $result->item(0) : null) {
                         $label->nodeValue = esc_html($field['labelAddressStreet2']);
                     }
                 }
                 if (isset($field['labelAddressStreet2Visible']) && $field['labelAddressStreet2Visible'] == false) {
                     if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_2_container']/label")) ? $result->item(0) : null) {
                         $styles = $label->getAttribute('style');
                         $label->setAttribute('style', trim("{$styles} display:none;"));
                     }
                 }
             }
             // process address city
             if ($process_placeholders && isset($field['placeholderAddressCity']) && !empty($field['placeholderAddressCity'])) {
                 if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_3']")) ? $result->item(0) : null) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholderAddressCity']));
                 }
             }
             if (isset($field['labelAddressCity'])) {
                 if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_3_container']/label")) ? $result->item(0) : null) {
                     $label->nodeValue = esc_html($field['labelAddressCity']);
                 }
             }
             if (isset($field['labelAddressCityVisible']) && $field['labelAddressCityVisible'] == false) {
                 if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_3_container']/label")) ? $result->item(0) : null) {
                     $styles = $label->getAttribute('style');
                     $label->setAttribute('style', trim("{$styles} display:none;"));
                 }
             }
             // process address state / province
             if (!isset($field['hideState']) || false === $field['hideState']) {
                 if ($process_placeholders && isset($field['placeholderAddressState']) && !empty($field['placeholderAddressState'])) {
                     if ($this->is_form_editor()) {
                         if ($input = ($result = $xpath->query("//input[@name='{$field_uid}.4']")) ? $result->item(0) : null) {
                             $input->setAttribute('placeholder', esc_attr($field['placeholderAddressState']));
                         }
                     } else {
                         if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_4']")) ? $result->item(0) : null) {
                             $input->setAttribute('placeholder', esc_attr($field['placeholderAddressState']));
                         }
                     }
                 }
                 if (isset($field['labelAddressState'])) {
                     if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_4_container']/label")) ? $result->item(0) : null) {
                         $label->nodeValue = esc_html($field['labelAddressState']);
                     }
                 }
                 if (isset($field['labelAddressStateVisible']) && $field['labelAddressStateVisible'] == false) {
                     if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_4_container']/label")) ? $result->item(0) : null) {
                         $styles = $label->getAttribute('style');
                         $label->setAttribute('style', trim("{$styles} display:none;"));
                     }
                 }
             }
             // process address zip / postal
             if ($process_placeholders && isset($field['placeholderAddressZip']) && !empty($field['placeholderAddressZip'])) {
                 if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_5']")) ? $result->item(0) : null) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholderAddressZip']));
                 }
             }
             if (isset($field['labelAddressZip'])) {
                 if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_5_container']/label")) ? $result->item(0) : null) {
                     $label->nodeValue = esc_html($field['labelAddressZip']);
                 }
             }
             if (isset($field['labelAddressZipVisible']) && $field['labelAddressZipVisible'] == false) {
                 if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_5_container']/label")) ? $result->item(0) : null) {
                     $styles = $label->getAttribute('style');
                     $label->setAttribute('style', trim("{$styles} display:none;"));
                 }
             }
             // process address country
             if (!isset($field['hideCountry']) || false === $field['hideCountry']) {
                 if (isset($field['labelAddressCountry'])) {
                     if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_6_container']/label")) ? $result->item(0) : null) {
                         $label->nodeValue = esc_html($field['labelAddressCountry']);
                     }
                 }
                 if (isset($field['labelAddressCountryVisible']) && $field['labelAddressCountryVisible'] == false) {
                     if ($label = ($result = $xpath->query("//span[@id='{$field_uid}_6_container']/label")) ? $result->item(0) : null) {
                         $styles = $label->getAttribute('style');
                         $label->setAttribute('style', trim("{$styles} display:none;"));
                     }
                 }
             }
             break;
             // break address
         // break address
         case 'date':
             $date_type = isset($field['dateType']) && !empty($field['dateType']) ? $field['dateType'] : 'datepicker';
             switch ($date_type) {
                 case 'datepicker':
                     // process date picker
                     if ($process_placeholders && isset($field['placeholder']) && !empty($field['placeholder'])) {
                         if ($this->is_form_editor()) {
                             if ($input = ($result = $xpath->query("//input[@name='ginput_datepicker']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                             }
                         } else {
                             if ($input = ($result = $xpath->query("//input[@id='{$field_uid}']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                             }
                         }
                     }
                     break;
                     // break datepicker
                 // break datepicker
                 case 'datefield':
                     // process date month
                     if ($process_placeholders && isset($field['placeholderDateMonth']) && !empty($field['placeholderDateMonth'])) {
                         if ($this->is_form_editor()) {
                             if ($input = ($result = $xpath->query("//input[@name='ginput_month']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderDateMonth']));
                             }
                         } else {
                             if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_1']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderDateMonth']));
                             }
                         }
                     }
                     if (isset($field['labelDateMonth'])) {
                         if ($this->is_form_editor()) {
                             if ($label = ($result = $xpath->query("//div[@id='gfield_input_date_month']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelDateMonth']);
                             }
                         } else {
                             if ($label = ($result = $xpath->query("//div[@id='{$field_uid}_1_container']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelDateMonth']);
                             }
                         }
                     }
                     if (isset($field['labelDateMonthVisible']) && $field['labelDateMonthVisible'] == false) {
                         if ($this->is_form_editor()) {
                             if ($label = ($result = $xpath->query("//div[@id='gfield_input_date_month']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         } else {
                             if ($label = ($result = $xpath->query("//div[@id='{$field_uid}_1_container']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         }
                     }
                     // process date day
                     if ($process_placeholders && isset($field['placeholderDateDay']) && !empty($field['placeholderDateDay'])) {
                         if ($this->is_form_editor()) {
                             if ($input = ($result = $xpath->query("//input[@name='ginput_day']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderDateDay']));
                             }
                         } else {
                             if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_2']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderDateDay']));
                             }
                         }
                     }
                     if (isset($field['labelDateDay'])) {
                         if ($this->is_form_editor()) {
                             if ($label = ($result = $xpath->query("//div[@id='gfield_input_date_day']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelDateDay']);
                             }
                         } else {
                             if ($label = ($result = $xpath->query("//div[@id='{$field_uid}_2_container']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelDateDay']);
                             }
                         }
                     }
                     if (isset($field['labelDateDayVisible']) && $field['labelDateDayVisible'] == false) {
                         if ($this->is_form_editor()) {
                             if ($label = ($result = $xpath->query("//div[@id='gfield_input_date_day']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         } else {
                             if ($label = ($result = $xpath->query("//div[@id='{$field_uid}_2_container']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         }
                     }
                     // process date year
                     if ($process_placeholders && isset($field['placeholderDateYear']) && !empty($field['placeholderDateYear'])) {
                         if ($this->is_form_editor()) {
                             if ($input = ($result = $xpath->query("//input[@name='ginput_year']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderDateYear']));
                             }
                         } else {
                             if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_3']")) ? $result->item(0) : null) {
                                 $input->setAttribute('placeholder', esc_attr($field['placeholderDateYear']));
                             }
                         }
                     }
                     if (isset($field['labelDateYear'])) {
                         if ($this->is_form_editor()) {
                             if ($label = ($result = $xpath->query("//div[@id='gfield_input_date_year']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelDateYear']);
                             }
                         } else {
                             if ($label = ($result = $xpath->query("//div[@id='{$field_uid}_3_container']/label")) ? $result->item(0) : null) {
                                 $label->nodeValue = esc_html($field['labelDateYear']);
                             }
                         }
                     }
                     if (isset($field['labelDateYearVisible']) && $field['labelDateYearVisible'] == false) {
                         if ($this->is_form_editor()) {
                             if ($label = ($result = $xpath->query("//div[@id='gfield_input_date_year']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         } else {
                             if ($label = ($result = $xpath->query("//div[@id='{$field_uid}_3_container']/label")) ? $result->item(0) : null) {
                                 $styles = $label->getAttribute('style');
                                 $label->setAttribute('style', trim("{$styles} display:none;"));
                             }
                         }
                     }
                     break;
                     // break datefield
             }
             // end switch
             break;
             // break date
         // break date
         case 'time':
             // process time hour
             if ($process_placeholders && isset($field['placeholderTimeHour']) && !empty($field['placeholderTimeHour'])) {
                 if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_1']")) ? $result->item(0) : null) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholderTimeHour']));
                 }
             }
             if (isset($field['labelTimeHour'])) {
                 if ($label = ($result = $xpath->query("//label[@for='{$field_uid}_1']")) ? $result->item(0) : null) {
                     $label->nodeValue = esc_html($field['labelTimeHour']);
                 }
             }
             if (isset($field['labelTimeHourVisible']) && $field['labelTimeHourVisible'] == false) {
                 if ($label = ($result = $xpath->query("//label[@for='{$field_uid}_1']")) ? $result->item(0) : null) {
                     $styles = $label->getAttribute('style');
                     $label->setAttribute('style', trim("{$styles} display:none;"));
                 }
             }
             // process time minute
             if ($process_placeholders && isset($field['placeholderTimeMinute']) && !empty($field['placeholderTimeMinute'])) {
                 if ($input = ($result = $xpath->query("//input[@id='{$field_uid}_2']")) ? $result->item(0) : null) {
                     $input->setAttribute('placeholder', esc_attr($field['placeholderTimeMinute']));
                 }
             }
             if (isset($field['labelTimeMinute'])) {
                 if ($label = ($result = $xpath->query("//label[@for='{$field_uid}_2']")) ? $result->item(0) : null) {
                     $label->nodeValue = esc_html($field['labelTimeMinute']);
                 }
             }
             if (isset($field['labelTimeMinuteVisible']) && $field['labelTimeMinuteVisible'] == false) {
                 if ($label = ($result = $xpath->query("//label[@for='{$field_uid}_2']")) ? $result->item(0) : null) {
                     $styles = $label->getAttribute('style');
                     $label->setAttribute('style', trim("{$styles} display:none;"));
                 }
             }
             break;
             // break time
         // break time
         case 'product':
         case 'singleproduct':
         case 'calculation':
             $product_disable_quantity = isset($field['disableQuantity']) && $field['disableQuantity'];
             if ($process_placeholders && !$product_disable_quantity && isset($field['placeholder']) && !empty($field['placeholder'])) {
                 if ($this->is_form_editor()) {
                     if ($input = ($result = $xpath->query("//input[@name='{$field_uid}.3']")) ? $result->item(0) : null) {
                         $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                     }
                 } else {
                     if ($input = ($result = $xpath->query("//input[@name='input_{$field_id}.3']")) ? $result->item(0) : null) {
                         $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                     }
                 }
             }
             break;
             // break product, singleproduct & caclulation
         // break product, singleproduct & caclulation
         case 'quantity':
             $quantity_type = isset($field['inputType']) && !empty($field['inputType']) ? $field['inputType'] : 'number';
             switch ($quantity_type) {
                 case 'number':
                     // Process Product Amount
                     if ($process_placeholders && isset($field['placeholder']) && !empty($field['placeholder'])) {
                         if ($input = ($result = $xpath->query("//input[@id='{$field_uid}']")) ? $result->item(0) : null) {
                             $input->setAttribute('placeholder', esc_attr($field['placeholder']));
                         }
                     }
                     break;
                     // break number
             }
             break;
             // break quantity
     }
     $field_content = $doc->SaveHTML();
     // remove our html wrapper from processed field
     $field_content = str_replace(array('<html>', '</html>', '<head>', '</head>', "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", '<body>', '</body>'), array('', '', '', '', '', '', ''), $field_content);
     $field_content = trim(preg_replace('/^<!DOCTYPE.+?>/', '', $field_content));
     // check if we are currently on ajax and fix double quotes to single.
     if (defined('RG_CURRENT_PAGE') && RG_CURRENT_PAGE == 'admin-ajax.php') {
         // replace non escaped double quotes with single quotes for ajax support
         $matches = array();
         preg_match_all('/"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"/s', $field_content, $matches);
         if (count($matches[0]) > 0) {
             foreach ($matches[0] as $match) {
                 $replace = "'" . substr($match, 1, strlen($match) - 2) . "'";
                 $field_content = str_replace($match, $replace, $field_content);
             }
         }
     }
     $this->log("processed field content", $field_content);
     // renable libxml error handling
     libxml_use_internal_errors($use_errors);
     return $field_content;
 }