case 'checkbox':
$post_meta_val = ( $post ) ? get_post_meta($post->ID, $result->field_name, false) : array();
$options = explode( ',', $result->field_values );
$options = array_map( 'trim', $options );
$optionCursor = 1;
$html_checkbox = '';
$html_options = '';
foreach ( $options as $option ) {
$field_class = ( $result->field_req ) ? 'checkboxlist required' : 'checkboxlist';
$args = array( 'value' => $option, 'type' => 'checkbox', 'class' => $field_class, 'name' => $result->field_name . '[]', 'id' => $result->field_name . '_' . $optionCursor++ );
if ( in_array($option, $post_meta_val) )
$args['checked'] = 'checked';
$args = apply_filters( 'cp_formbuilder_' . $result->field_name, $args, $result, $post );
$html_checkbox = html( 'input', $args ) . ' ' . $option;
$html_options .= html( 'li', array(), $html_checkbox );
}
echo html( 'ol', array( 'class' => 'checkboxes' ), $html_options );
echo html( 'div', array( 'class' => 'clr' ) );
break;
case 'checkbox':
$post_meta_val = ( $post ) ? get_post_meta($post->ID, $result->field_name, false) : array();
$options = explode( ',', $result->field_values );
$options = array_map( 'trim', $options );
$optionCursor = 1;
$html_checkbox = '';
$html_options = '';
foreach ( $options as $option ) {
$field_class = ( $result->field_req ) ? 'checkboxlist required' : 'checkboxlist';
$args = array( 'value' => $option, 'type' => 'checkbox', 'class' => $field_class, 'name' => $result->field_name . '[]', 'id' => $result->field_name . '_' . $optionCursor++ );
if ( in_array($option, $post_meta_val) )
$args['checked'] = 'checked';
$args = apply_filters( 'cp_formbuilder_' . $result->field_name, $args, $result, $post );
//#add label within li
$html_checkbox = html( 'input', $args ) . '
<label for=' . $result->field_name . '_' . $optionCursor . '>' . $option . '</label>';
$html_options .= html( 'li', array(), $html_checkbox );
}
echo html( 'ol', array( 'class' => 'checkboxes' ), $html_options );
echo html( 'div', array( 'class' => 'clr' ) );
break;
There are currently 1 users browsing this thread. (0 members and 1 guests)