Пример #1
0
 /**
  * Add the collapse icon next to collapsible section headings
  *
  * @since 2.0.14
  *
  * @param string $trigger
  * @param array $field
  * @param string $html, pass by reference
  */
 private static function maybe_add_collapse_icon($trigger, $field, &$html)
 {
     if (!empty($trigger)) {
         $style = FrmStylesController::get_form_style($field['form_id']);
         preg_match_all("/\\<h[2-6]\\b(.*?)(?:(\\/))?\\>(.*?)(?:(\\/))?\\<\\/h[2-6]>/su", $html, $headings, PREG_PATTERN_ORDER);
         if (isset($headings[3]) && !empty($headings[3])) {
             $header_text = reset($headings[3]);
             $old_header_html = reset($headings[0]);
             if ('before' == $style->post_content['collapse_pos']) {
                 $new_header_html = str_replace($header_text, '<i class="frm_icon_font frm_arrow_icon"></i> ' . $header_text, $old_header_html);
             } else {
                 $new_header_html = str_replace($header_text, $header_text . '<i class="frm_icon_font frm_arrow_icon"></i> ', $old_header_html);
             }
             $html = str_replace($old_header_html, $new_header_html, $html);
         }
     }
 }
Пример #2
0
 public static function add_field_class($class, $field)
 {
     if ($field['type'] == 'scale' && FrmField::is_option_true($field, 'star')) {
         $class .= ' star';
     } else {
         if ($field['type'] == 'date') {
             $class .= ' frm_date';
         } else {
             if ($field['type'] == 'file' && FrmField::is_option_true($field, 'multiple')) {
                 $class .= ' frm_multiple_file';
             }
         }
     }
     // Hide the "No files selected" text if files are selected
     if ($field['type'] == 'file' && !FrmField::is_option_empty($field, 'value')) {
         $class .= ' frm_transparent';
     }
     if (!FrmAppHelper::is_admin() && FrmField::is_option_true($field, 'autocom') && ($field['type'] == 'select' || $field['type'] == 'data' && isset($field['data_type']) && $field['data_type'] == 'select') && !empty($field['options']) && !FrmField::is_read_only($field)) {
         global $frm_vars;
         $frm_vars['chosen_loaded'] = true;
         $class .= ' frm_chzn';
         $style = FrmStylesController::get_form_style($field['form_id']);
         if ($style && 'rtl' == $style->post_content['direction']) {
             $class .= ' chosen-rtl';
         }
     }
     return $class;
 }