Пример #1
0
 public static function fill_entry_values($atts, $f, array &$values)
 {
     if (FrmField::is_no_save_field($f->type)) {
         return;
     }
     if ($atts['default_email']) {
         self::get_field_shortcodes_for_default_email($f, $values);
         return;
     }
     if ($atts['entry'] && !isset($atts['entry']->metas[$f->id])) {
         // In case include_blank is set
         $atts['entry']->metas[$f->id] = '';
         if (FrmAppHelper::pro_is_installed()) {
             FrmProEntryMeta::add_post_value_to_entry($f, $atts['entry']);
             FrmProEntryMeta::add_repeating_value_to_entry($f, $atts['entry']);
         }
     }
     $val = '';
     if ($atts['entry']) {
         $prev_val = maybe_unserialize($atts['entry']->metas[$f->id]);
         $meta = array('item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type);
         //This filter applies to the default-message shortcode and frm-show-entry shortcode only
         if (isset($atts['filter']) && $atts['filter'] == false) {
             $val = $prev_val;
         } else {
             $val = apply_filters('frm_email_value', $prev_val, (object) $meta, $atts['entry']);
         }
     }
     // Don't include blank values
     if (!$atts['include_blank'] && FrmAppHelper::is_empty_value($val)) {
         return;
     }
     self::textarea_display_value($f->type, $atts['plain_text'], $val);
     $val = apply_filters('frm_display_' . $f->type . '_value_custom', $val, array('field' => $f, 'atts' => $atts));
     if (is_array($val)) {
         if ($atts['format'] == 'text') {
             $val = implode(', ', $val);
         } else {
             if ($f->type == 'checkbox') {
                 $val = array_values($val);
             }
         }
     }
     self::maybe_strip_html($atts['plain_text'], $val);
     if ($atts['format'] != 'text') {
         $values[$f->field_key] = $val;
         if (isset($prev_val) && $prev_val != $val && $f->type != 'textarea') {
             $values[$f->field_key . '-value'] = $prev_val;
         }
     } else {
         $values[$f->id] = array('label' => $f->name, 'val' => $val);
     }
 }
 /**
  * Get values in nested forms (repeating sections and embed form)
  *
  * @since 2.0.09
  * @param object $field
  * @param array $atts
  */
 private static function get_sub_field_values($field, &$atts)
 {
     foreach ($atts['entries'] as $key => $entry) {
         if (!isset($entry->metas[$field->id]) || $entry->metas[$field->id] == '') {
             FrmProEntryMeta::add_repeating_value_to_entry($field, $atts['entries'][$key]);
         }
     }
 }