__( 'Text Input', 'pc-form-builder-xyz123' ),
'email' => __( 'Email', 'pc-form-builder-xyz123' ),
'name' => __( 'Name', 'pc-form-builder-xyz123' ),
'response' => __( 'Response', 'pc-form-builder-xyz123' ),
'dropdown' => __( 'Dropdown', 'pc-form-builder-xyz123' ),
'checkbox' => __( 'Checkbox', 'pc-form-builder-xyz123' ),
);
}
public function get_form_fields( $form_id ) {
global $wpdb;
$table_name = $wpdb->prefix . 'pcfb_fields';
return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE form_id = %d ORDER BY sort_order ASC", $form_id ) );
}
public function render_field_item( $field, $index = 0 ) {
$validation_rules = maybe_unserialize( $field->validation_rules );
$options = maybe_unserialize( $field->options );
$field_types = $this->get_field_types();
$field_type_label = isset( $field_types[ $field->field_type ] ) ? $field_types[ $field->field_type ] : $field->field_type;
?>
get_field_types();
$field_type_label = isset( $field_types[ $field_type ] ) ? $field_types[ $field_type ] : $field_type;
$default_labels = array(
'text' => __( 'Text Field', 'pc-form-builder-xyz123' ),
'email' => __( 'Email Address', 'pc-form-builder-xyz123' ),
'name' => __( 'Full Name', 'pc-form-builder-xyz123' ),
'response' => __( 'Your Response', 'pc-form-builder-xyz123' ),
'dropdown' => __( 'Select Option', 'pc-form-builder-xyz123' ),
'checkbox' => __( 'Checkboxes', 'pc-form-builder-xyz123' ),
);
$default_label = isset( $default_labels[ $field_type ] ) ? $default_labels[ $field_type ] : __( 'Field', 'pc-form-builder-xyz123' );
$placeholder = '';
if ( 'response' === $field_type ) {
$placeholder = __( 'Enter your response here...', 'pc-form-builder-xyz123' );
}
?>
'dashicons-text',
'email' => 'dashicons-email',
'name' => 'dashicons-admin-users',
'response' => 'dashicons-editor-quote',
'dropdown' => 'dashicons-arrow-down-alt2',
'checkbox' => 'dashicons-yes',
);
public static function get_field_icon( $type ) {
return isset( self::$icons[ $type ] ) ? self::$icons[ $type ] : 'dashicons-editor-help';
}
}
}