Ejemplo n.º 1
0
 /**
  * @param GF_Field  	$field
  * @param string 		$value
  * @param bool   		$force_frontend_label
  * @param int   		$form_id
  * @param null|array   	$form
  *
  * @return string
  */
 public static function get_field_content($field, $value = '', $force_frontend_label = false, $form_id = 0, $form = null)
 {
     $field_label = $field->get_field_label($form, $value);
     $admin_buttons = $field->get_admin_buttons();
     $input_type = GFFormsModel::get_input_type($field);
     $is_form_editor = GFCommon::is_form_editor();
     $is_entry_detail = GFCommon::is_entry_detail();
     $is_admin = $is_form_editor || $is_entry_detail;
     if ($input_type == 'adminonly_hidden') {
         $field_content = !$is_admin ? '{FIELD}' : sprintf("%s<label class='gfield_label' >%s</label>{FIELD}", $admin_buttons, esc_html($field_label));
     } else {
         $field_content = $field->get_field_content($value, $force_frontend_label, $form);
     }
     if ($input_type == 'creditcard' && !GFCommon::is_ssl() && !$is_admin) {
         $field_content = "<div class='gfield_creditcard_warning_message'><span>" . esc_html__('This page is unsecured. Do not enter a real credit card number! Use this field only for testing purposes. ', 'gravityforms') . '</span></div>' . $field_content;
     }
     $value = $field->get_value_default_if_empty($value);
     $field_content = str_replace('{FIELD}', GFCommon::get_field_input($field, $value, 0, $form_id, $form), $field_content);
     $field_content = apply_filters('gform_field_content', $field_content, $field, $value, 0, $form_id);
     return $field_content;
 }