Inventory_Presser_Google_Maps_Widget::form( array $instance )

form


Description Description

Outputs the widget settings form that is shown in the dashboard.


Top ↑

Parameters Parameters

$instance

(array) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/widget/class-widget-google-maps.php

	public function form( $instance ) {

		$title = isset( $instance['title'] ) ? $instance['title'] : '';

		?>
		<p>
			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'inventory-presser' ); ?></label>
			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
		</p>
		<p>
		<?php _e( 'Choose an Address', 'inventory-presser' ); ?>
		</p>
		<?php

		// get all location terms
		$location_terms = get_terms( 'location', array( 'hide_empty' => false ) );

		$location_slug = isset( $instance['location_slug'] ) ? $instance['location_slug'] : '';

		// loop through each location, set up form
		foreach ( $location_terms as $index => $term_object ) {
			printf(
				'<p><input id="%s" name="%s" value="%s" type="radio"%s> <label for="%s">%s</label></p>',
				$this->get_field_id( $term_object->slug ),
				$this->get_field_name( 'location_slug' ),
				$term_object->slug,
				checked( $term_object->slug, $location_slug, false ),
				$this->get_field_id( $term_object->slug ),
				nl2br( $term_object->description )
			);
		}
	}