<?php
/**
 * WeCodeArt Framework.
 *
 * WARNING: This file is part of the core WeCodeArt Framework. DO NOT edit this file under any circumstances.
 * Please do all modifications in the form of a child theme.
 *
 * @package 	WeCodeArt Framework
 * @subpackage 	Login Template
 * @since 	    5.1.8
 * @version	    6.4.5
 */

defined( 'ABSPATH' ) || exit;

\wecodeart( 'styles' )->Utilities->load( [ 'mb-3' ] );

$hooks = [
    'top'       => apply_filters( 'login_form_top', '', $args ),
    'middle'    => apply_filters( 'login_form_middle', '', $args ),
    'bottom'    => apply_filters( 'login_form_bottom', '', $args ),
]

/**
 * @param   array   $args   Contains the form args
 */
?>
<form class="needs-validation" action="<?php echo esc_url( wp_login_url() ); ?>" method="post" novalidate>
    <?php
    
        // WP Filter
        echo $hooks['top'];
    
    ?>
    <?php
            
        wecodeart_input( 'floating', [
            'type'  => 'text',
            'label' => $args['label_username'],
            'attrs' => [
                'id'        => $args['id_username'] ?? null,
                'name'      => 'log',
                'value'     => $args['value_username'],
                'size'      => 20,
                'required'  => true,
                'class'     => 'form-control mb-3',
                'placeholder' => ' ',
            ]
        ] );
                
        wecodeart_input( 'floating', [
            'type'  => 'password',
            'label' => $args['label_password'],
            'attrs' => [
                'id'        => $args['id_password'] ?? null,
                'name'      => 'pwd',
                'size'      => 20,
                'required'  => true,
                'class'     => 'form-control mb-3',
                'placeholder' => ' ',
            ]
        ] );
    
        // WP Filter
        echo $hooks['middle'];
    
        if( $args['remember'] ) :
    
        wecodeart_input( 'toggle', [
            'type'  => 'checkbox',
            'label' => $args['label_remember'],
            'attrs' => [
                'id'        => $args['id_remember'] ?? null,
                'name'      => 'rememberme',
                'value'     => 'forever',
                'class'     => 'form-switch mb-3',
                'checked'   => (bool) $args['value_remember']
            ]
        ] );
    
        endif;

        $button_class = [ 'wp-block-button', 'wp-block-button--login', ! empty( $hooks['bottom'] ) ? 'mb-3' : '' ];
    ?>
    <div class="<?php echo esc_attr( join( ' ', $button_class ) ); ?>">
    <?php

        wecodeart_input( 'submit', [
            'attrs' => [
                'name'  => false,
                'id'    => $args['id_submit'] ?? null,
                'value' => $args['label_log_in'],
            ]
        ] );

        wecodeart_input( 'hidden', [
            'attrs' => [
                'id'    => false,
                'name'  => 'redirect_to',
                'value' => esc_url( $args['redirect'] )
            ]
        ] );

    ?>
    </div>
    <?php
        
        // WP Filter
        echo $hooks['bottom'];
        
    ?>
</form>
		