YelpReviews_Widget::form( array $instance )
Widget Backend.
Contents
Parameters Parameters
- $instance
-
(array) (Required) instance
Source Source
File: mortgage-yelp-review/inc/YelpReviews_Widget.php
public function form( $instance ) {
$defaults = array(
'title' => ' ',
'count' => '3',
'style' => 'list'
);
$instance = wp_parse_args( (array) $instance, $defaults );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html__( 'Title', 'YelpReviewsWidget' ); ?></label>
<input id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" type="text"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php echo esc_html__( 'Count', 'YelpReviewsWidget' ); ?></label>
<input id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>"
value="<?php echo esc_attr( $instance['count'] ); ?>" class="widefat" type="number" min="0" max="10" step="1"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'style' ) ); ?>"><?php echo esc_html__( 'Style', 'YelpReviewsWidget' ); ?></label>
<select id="<?php echo $this->get_field_id('style'); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'style' ) ); ?>">
<option <?php selected( $instance['style'], 'list' ); ?> value="list"><?php echo esc_html__( 'List', 'YelpReviewsWidget' ); ?></option>
<option <?php selected( $instance['style'], 'grid' ); ?> value="grid"><?php echo esc_html__( 'Grid', 'YelpReviewsWidget' ); ?></option>
<option <?php selected( $instance['style'], 'slider' ); ?> value="slider"><?php echo esc_html__( 'Slider', 'YelpReviewsWidget' ); ?></option>
</select>
</p>
<?php
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |