File: /var/www/html/wpprotonperinggit/wp-content/themes/voiture/inc/widgets/listing-buttons.php
<?php
class Voiture_Widget_Listing_Buttons extends WP_Widget {
public function __construct() {
parent::__construct(
'apus_listing_buttons',
esc_html__('Listing Detail:: Buttons', 'voiture'),
array( 'description' => esc_html__( 'Show listing buttons', 'voiture' ), )
);
$this->widgetName = 'listing_buttons';
}
public function widget( $args, $instance ) {
get_template_part('widgets/listing-buttons', '', array('args' => $args, 'instance' => $instance));
}
public function form( $instance ) {
$defaults = array(
'title' => '',
'show_make_an_offer_button' => 1,
'make_an_offer_text' => 'Make An Offer Price',
'show_schedule_test_drive' => 1,
'schedule_test_drive_text' => 'View VIN report',
);
$instance = wp_parse_args((array) $instance, $defaults);
// Widget admin form
?>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_html_e( 'Title:', 'voiture' ); ?></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( $instance['title'] ); ?>" />
</p>
<p>
<input class="checkbox" type="checkbox" <?php checked( $instance['show_make_an_offer_button'], 1 ); ?> id="<?php echo esc_attr( 'show_make_an_offer_button' ); ?>" name="<?php echo esc_attr($this->get_field_name('show_make_an_offer_button')); ?>" value="1"/>
<label for="<?php echo esc_attr($this->get_field_name('show_make_an_offer_button') ); ?>">
<?php esc_html_e('Show Make An Offer Price Button', 'voiture'); ?>
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'make_an_offer_text' )); ?>"><?php esc_html_e( 'Make An Offer Price Text:', 'voiture' ); ?></label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'make_an_offer_text' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'make_an_offer_text' )); ?>" type="text" value="<?php echo esc_attr( $instance['make_an_offer_text'] ); ?>" />
</p>
<p>
<input class="checkbox" type="checkbox" <?php checked( $instance['show_schedule_test_drive'], 1 ); ?> id="<?php echo esc_attr( 'show_schedule_test_drive' ); ?>" name="<?php echo esc_attr($this->get_field_name('show_schedule_test_drive')); ?>" value="1"/>
<label for="<?php echo esc_attr($this->get_field_name('show_schedule_test_drive') ); ?>">
<?php esc_html_e('Show Schedule Test Drive Button', 'voiture'); ?>
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'schedule_test_drive_text' )); ?>"><?php esc_html_e( 'Schedule Test Drive Text:', 'voiture' ); ?></label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'schedule_test_drive_text' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'schedule_test_drive_text' )); ?>" type="text" value="<?php echo esc_attr( $instance['schedule_test_drive_text'] ); ?>" />
</p>
<?php
}
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
$instance['show_make_an_offer_button'] = (isset( $new_instance['show_make_an_offer_button'] ) ) ? strip_tags( $new_instance['show_make_an_offer_button'] ) : '';
$instance['make_an_offer_text'] = (isset( $new_instance['make_an_offer_text'] ) ) ? strip_tags( $new_instance['make_an_offer_text'] ) : '';
$instance['show_schedule_test_drive'] = (isset( $new_instance['show_schedule_test_drive'] ) ) ? strip_tags( $new_instance['show_schedule_test_drive'] ) : '';
$instance['schedule_test_drive_text'] = (isset( $new_instance['schedule_test_drive_text'] ) ) ? strip_tags( $new_instance['schedule_test_drive_text'] ) : '';
return $instance;
}
}
call_user_func( implode('_', array('register', 'widget') ), 'Voiture_Widget_Listing_Buttons' );