<?php $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; ?>
<?php $count = ! empty( $instance['count'] ) ? $instance['count'] : 10; ?>
<?php $attribute = ! empty( $instance['attribute'] ) ? $instance['attribute'] : ''; ?>
<?php $fullwidth = ! empty( $instance['fullwidth'] ) ? $instance['fullwidth'] : ''; ?>

<!-- TITLE -->
<p>
    <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
        <?php echo __( 'Title', 'realia' ); ?>
    </label>


    <input  class="widefat"
            id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
            name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
            type="text"
            value="<?php echo esc_attr( $title ); ?>">
</p>

<!-- FULLWIDTH -->
<p>
    <input  type="checkbox"
            class="checkbox" 
            <?php echo ! empty( $fullwidth ) ? 'checked="checked"' : ''; ?>
            id="<?php echo esc_attr( $this->get_field_id( 'fullwidth' ) ); ?>"
            name="<?php echo esc_attr( $this->get_field_name( 'fullwidth' ) ); ?>">

    <label for="<?php echo esc_attr( $this->get_field_id( 'fullwidth' ) ); ?>">
        <?php echo __( 'Fullwidth', 'realia' ); ?>
    </label>
</p>

<!-- COUNT -->
<p>
    <label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>">
        <?php echo __( 'Count', 'realia' ); ?>
    </label>

    <input  class="widefat"
            id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"
            name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>"
            type="text"
            value="<?php echo esc_attr( $count ); ?>">
</p>

<!-- ATTRIBUTE -->
<p>
    <strong><?php echo __( 'Choose attribute', 'realia' ); ?></strong><br>    
    <ul>
        <li>
            <label>
                <input  type="radio"
                        class="radio" 
                        <?php echo ( empty( $attribute ) || $attribute == 'on' ) ? 'checked="checked"' : ''; ?>
                        id="<?php echo esc_attr( $this->get_field_id( 'attribute' ) ); ?>"
                        name="<?php echo esc_attr( $this->get_field_name( 'attribute' ) ); ?>">    
                <?php echo __( 'It doesn\'t matter', 'realia' ); ?>
            </label>
        </li>

        <li>
            <label>
                <input  type="radio"
                        class="radio" 
                        value="featured"
                        <?php echo ( $attribute == 'featured' ) ? 'checked="checked"' : ''; ?>
                        id="<?php echo esc_attr( $this->get_field_id( 'attribute' ) ); ?>"
                        name="<?php echo esc_attr( $this->get_field_name( 'attribute' ) ); ?>">    
                <?php echo __( 'Featured only', 'realia' ); ?>
            </label>            
        </li>

        <li>
            <label>
                <input  type="radio"
                        class="radio" 
                        value="reduced"
                        <?php echo ( $attribute == 'reduced' ) ? 'checked="checked"' : ''; ?>
                        id="<?php echo esc_attr( $this->get_field_id( 'attribute' ) ); ?>"
                        name="<?php echo esc_attr( $this->get_field_name( 'attribute' ) ); ?>">

                <?php echo __( 'Reduced only', 'realia' ); ?>
            </label>            
        </li>        
    </ul>
</p>