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 esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'inventory-presser' ); ?></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>
		<p>
		<?php esc_html_e( 'Choose an Address', 'inventory-presser' ); ?>
		</p>
		<?php

		// get all location terms.
		$location_terms = get_terms(
			array(
				'taxonomy'   => 'location',
				'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="%1$s" name="%2$s" value="%3$s" type="radio"%4$s> <label for="%1$s">%5$s</label></p>',
				esc_attr( $this->get_field_id( $term_object->slug ) ),
				esc_attr( $this->get_field_name( 'location_slug' ) ),
				esc_attr( $term_object->slug ),
				checked( $term_object->slug, $location_slug, false ),
				esc_html( nl2br( $term_object->description ) )
			);
		}
	}