<?php

add_filter('comment_form_default_fields', 'buconz_starter_comment_form');

function buconz_starter_comment_form($buconz_starter_fields){
	
    $buconz_starter_fields['author'] = '
        <div class="row comment-form-wrap">
        <div class="col-lg-4 col-md-4 col-12">
            <div class="form-group">
				<label for="author">'.esc_html__('Your Name', 'buconz-starter').' <span class="required">*</span></label>
				<div class="form-inline-field">
					<i class="fa fa-user"></i>
					<input type="text" name="author" id="name-cmt" required="required">
				</div>
            </div>
        </div>
    ';

    $buconz_starter_fields['email'] =  '
        <div class="col-lg-4 col-md-4 col-12">
            <div class="form-group">
				<label for="email">'.esc_html__('Your Email', 'buconz-starter').' <span class="required">*</span></label>
				<div class="form-inline-field">
					<i class="fa fa-envelope"></i>
					<input type="text" name="email" id="email-cmt" required="required">
				</div>
            </div>
        </div>
    ';

    $buconz_starter_fields['url'] = '
        <div class="col-lg-4 col-md-4 col-12">
            <div class="form-group">
				<label for="url">'.esc_html__('Your Website', 'buconz-starter').'</label>
				<div class="form-inline-field">
					<i class="fa fa-globe"></i>
					<input type="text" name="url" id="website">
				</div>
            </div>
        </div>
        </div>
        
    ';

    return $buconz_starter_fields;
}


add_filter('comment_form_defaults', 'buconz_starter_comment_default_form');

function buconz_starter_comment_default_form($default_form){

    $default_form['comment_field'] = '
        <div class="row">
            <div class="col-12">
                <div class="comment-message">
					<label for="comment">'.esc_html__('Type Message', 'buconz-starter').' <span class="required">*</span></label>
					<div class="form-inline-field">
						<i class="fa fa-pencil"></i>
						<textarea name="comment" rows="6" required="required"></textarea>
					</div>
                </div>
            </div>
    ';

    $default_form['submit_button'] = '
        </div>
        <button type="submit" class="btn theme-2 effect">'.esc_html__('Submit Comment', 'buconz-starter').'<i class="fa fa-long-arrow-right"></i></button>
    ';

    $default_form['comment_notes_before'] = esc_html__('All fields marked with an asterisk (*) are required', 'buconz-starter' );
    $default_form['title_reply'] = esc_html__('Leave a comment', 'buconz-starter');
    $default_form['title_reply_before'] = '<div class="bottom-title"><h2 class="comments-heading">';
    $default_form['title_reply_after'] = '</h2></div>';

    return $default_form;
}


function buconz_starter_move_comment_field_to_bottom( $fields ) {
    $comment_field = $fields['comment'];
    unset( $fields['comment'] );
    $fields['comment'] = $comment_field;
    return $fields;
}

add_filter( 'comment_form_fields', 'buconz_starter_move_comment_field_to_bottom' );