/**
  * The function used to create a form element
  *
  * @since 1.0.0
  *
  * @param string $meta Meta name.	 
  * @param array $details Contains the details for the field.	 
  * @param string $value Contains input value;
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
  * @param int $post_id The post ID;
  * @return string $element input element html string.
  */
 function wck_output_form_field($meta, $details, $value = '', $context = '', $post_id = '')
 {
     $element = '';
     if ($context == 'edit_form') {
         $edit_class = '.mb-table-container ';
         $var_prefix = 'edit';
     } else {
         if ($context == 'fep') {
             /* id prefix for frontend posting */
             $frontend_prefix = 'fep-';
         } else {
             if (isset($details['default']) && !($this->args['single'] == true && !is_null($value))) {
                 $value = apply_filters("wck_default_value_{$meta}_" . Wordpress_Creation_Kit_QUM::wck_generate_slug($details['title'], $details), $details['default']);
             }
         }
     }
     /* for single post meta metaboxes we need a prefix in the name attr of the input because in the case we have multiple single metaboxes on the same
        post we need to prevent the fields from having the same name attr */
     if ($this->args['context'] == 'post_meta' && $this->args['single'] && $context != 'fep') {
         $single_prefix = $this->args['meta_name'] . '_';
     } else {
         $single_prefix = '';
     }
     $element .= '<label for="' . $single_prefix . esc_attr(Wordpress_Creation_Kit_QUM::wck_generate_slug($details['title'], $details)) . '" class="field-label">' . apply_filters("wck_label_{$meta}_" . Wordpress_Creation_Kit_QUM::wck_generate_slug($details['title'], $details), ucfirst($details['title'])) . ':';
     if (!empty($details['required']) && $details['required']) {
         $element .= '<span class="required">*</span>';
     }
     $element .= '</label>';
     $element .= '<div class="mb-right-column">';
     /* 
     include actual field type
     possible field types: text, textarea, select, checkbox, radio, upload, wysiwyg editor, datepicker, country select, user select, cpt select
     */
     if (function_exists('wck_nr_get_repeater_boxes')) {
         $cfc_titles = wck_nr_get_repeater_boxes();
         if (in_array($details['type'], $cfc_titles)) {
             $details['type'] = 'nested repeater';
         }
     }
     if (file_exists(dirname(__FILE__) . '/fields/' . $details['type'] . '.php')) {
         require dirname(__FILE__) . '/fields/' . $details['type'] . '.php';
     }
     if (!empty($details['description'])) {
         $element .= '<p class="description">' . $details['description'] . '</p>';
     }
     $element .= '</div><!-- .mb-right-column -->';
     $element = apply_filters("wck_output_form_field_{$meta}_" . Wordpress_Creation_Kit_QUM::wck_generate_slug($details['title'], $details), $element);
     return $element;
 }
 /**
  * The function used to create a form element
  *
  * @since 1.0.0
  *
  * @param string $meta Meta name.	 
  * @param array $details Contains the details for the field.	 
  * @param string $value Contains input value;
  * @param string $context Context where the function is used. Depending on it some actions are preformed.;
  * @param int $post_id The post ID;
  * @return string $element input element html string.
  */
 function wck_output_form_field($meta, $details, $value = '', $context = '', $post_id = '')
 {
     $element = '';
     if ($context == 'edit_form') {
         $edit_class = '.mb-table-container ';
         $var_prefix = 'edit';
     } else {
         if ($context == 'fep') {
             /* id prefix for frontend posting */
             $frontend_prefix = 'fep-';
         } else {
             if (isset($details['default'])) {
                 $value = apply_filters("wck_default_value_{$meta}_" . Wordpress_Creation_Kit::wck_generate_slug($details['title']), $details['default']);
             }
         }
     }
     $element .= '<label for="' . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'])) . '" class="field-label">' . apply_filters("wck_label_{$meta}_" . Wordpress_Creation_Kit::wck_generate_slug($details['title']), ucfirst($details['title'])) . ':';
     if (!empty($details['required']) && $details['required']) {
         $element .= '<span class="required">*</span>';
     }
     $element .= '</label>';
     $element .= '<div class="mb-right-column">';
     /* 
     include actual field type
     possible field types: text, textarea, select, checkbox, radio, upload, wysiwyg editor, datepicker, country select, user select, cpt select
     */
     if (function_exists('wck_nr_get_repeater_boxes')) {
         $cfc_titles = wck_nr_get_repeater_boxes();
         if (in_array($details['type'], $cfc_titles)) {
             $details['type'] = 'nested repeater';
         }
     }
     if (file_exists(dirname(__FILE__) . '/fields/' . $details['type'] . '.php')) {
         require dirname(__FILE__) . '/fields/' . $details['type'] . '.php';
     }
     if (!empty($details['description'])) {
         $element .= '<p class="description">' . $details['description'] . '</p>';
     }
     $element .= '</div><!-- .mb-right-column -->';
     $element = apply_filters("wck_output_form_field_{$meta}_" . Wordpress_Creation_Kit::wck_generate_slug($details['title']), $element);
     return $element;
 }