Inventory_Presser_Taxonomies::edit_location_field( WP_Term $term, string $taxonomy )

edit_location_field


Description Description

Outputs HTML that renders additional fields for the edit term screen.


Top ↑

Parameters Parameters

$term

(WP_Term) (Required) Current taxonomy term object.

$taxonomy

(string) (Required) Current taxonomy slug.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-taxonomies.php

	function edit_location_field( $term, $taxonomy )
	{
		?><tr class="form-field term-group-wrap">
			<th scope="row"><label><?php _e( 'Phone Numbers', 'inventory-presser' ); ?></label></th>
			<td>
				<div class="repeat-group">
					<div class="repeat-container"><?php

					$phones = $this->get_phones( $term->term_id );
					if( ! empty( $phones ) )
					{
						foreach( $phones as $phone )
						{
							?><div class="repeated">
							<div class="repeat-form"><?php

							printf(
								'<input type="hidden" name="phone_uid[]" value="%s" />'
								. '<input type="text" name="phone_description[]" value="%s" placeholder="%s" />'
								. '<input type="text" name="phone_number[]" value="%s" placeholder="%s" />',
								$phone['uid'],
								$phone['description'],
								__( 'Label', 'inventory-presser' ),
								$phone['number'],
								__( 'Number', 'inventory-presser' )
							);

							?></div>
							<div class="repeat-buttons">
								<span class="dashicons dashicons-menu repeat-move"></span>
								<span class="dashicons dashicons-trash repeat-delete"></span>
							</div>
						</div><?php

						}
					}

					?></div>
					<div class="repeat-this">
						<div class="repeat-form">
							<input type="text" name="phone_description[]" placeholder="<?php _e( 'Label', 'inventory-presser' ); ?>" />
							<input type="text" name="phone_number[]" placeholder="<?php _e( 'Number', 'inventory-presser' ); ?>" />
						</div>
						<div class="repeat-buttons">
							<span class="dashicons dashicons-menu repeat-move" title="<?php _e( 'Drag to reposition', 'inventory-presser' ); ?>"></span>
							<span class="dashicons dashicons-trash repeat-delete" title="<?php _e( 'Delete this set of hours', 'inventory-presser' ); ?>"></span>
						</div>
					</div>
					<button type="button" class="repeat-add button action"><?php _e( 'Add Phone Number', 'inventory-presser' ); ?></button>
				</div>
			</td>
		</tr>
		<tr class="form-field term-group-wrap">
			<th scope="row"><label><?php _e( 'Hours', 'inventory-presser' ); ?></label></th>
			<td>
				<div class="repeat-group">
					<div class="repeat-container"><?php

					$hours_sets = self::get_hours( $term->term_id );
					$days = array_keys( INVP::weekdays() );
					if( ! empty( $hours_sets ) )
					{
						foreach( $hours_sets as $hours )
						{

						?><div class="repeated">
							<div class="repeat-form">

								<input type="text" name="hours_title[]" placeholder="<?php _e( 'Title', 'inventory-presser' ); ?>" value="<?php echo $hours['title'] ?>" />
								<input type="hidden" name="hours_uid[]" placeholder="<?php _e( 'Title', 'inventory-presser' ); ?>" value="<?php echo $hours['uid'] ?>" />

								<table class="repeater-table hours">
									<thead>
										<th class="day-col"></th>
										<th><?php _e( 'Open', 'inventory-presser' ); ?></th>
										<th class="to-col"></th>
										<th><?php _e( 'Close', 'inventory-presser' ); ?></th>
										<th><?php _e( 'Appt Only', 'inventory-presser' ); ?></th>
									</thead>
									<tbody><?php

										for( $d=0; $d<7; $d++)
										{

										?><tr>
										<td><?php echo ucfirst( substr( $days[$d], 0, 3 ) ); ?></td>
										<td><input name="hours[<?php echo $d ?>][open][]" class="timepick" type="text" value="<?php echo $hours[$days[$d] . '_open'] ?>"></td>
										<td>to</td>
										<td><input name="hours[<?php echo $d ?>][close][]" class="timepick" type="text" value="<?php echo $hours[$days[$d] . '_close'] ?>"></td>
										<td>
											<select name="hours[<?php echo $d ?>][appt][]" autocomplete="off">
												<option value="0"<?php echo ($hours[$days[$d] . '_appt'] == '0') ? ' selected' : ''; ?>><?php _e( 'No', 'inventory-presser' ); ?></option>
												<option value="1"<?php echo ($hours[$days[$d] . '_appt'] == '1') ? ' selected' : ''; ?>><?php _e( 'Yes', 'inventory-presser' ); ?></option>
											</select>
										</td>
									</tr><?php

										}

								?></tbody>
							</table>

							</div>
							<div class="repeat-buttons">
								<span class="dashicons dashicons-menu repeat-move" title="<?php _e( 'Drag to reposition', 'inventory-presser' ); ?>"></span>
								<span class="dashicons dashicons-trash repeat-delete" title="<?php _e( 'Delete this set of hours', 'inventory-presser' ); ?>"></span>
							</div>
						</div><?php

						}
					}

					?></div>
					<div class="repeat-this">
						<div class="repeat-form">

							<input type="text" name="hours_title[]" placeholder="Title" />

							<table class="repeater-table hours">
								<thead>
									<th class="day-col"></th>
									<th><?php _e( 'Open', 'inventory-presser' ); ?></th>
									<th class="to-col"></th>
									<th><?php _e( 'Close', 'inventory-presser' ); ?></th>
									<th><?php _e( 'Appt Only', 'inventory-presser' ); ?></th>
								</thead>
								<tbody><?php

									foreach( array_keys( INVP::weekdays() ) as $d => $day )
									{

									?><tr>
										<td><?php echo ucfirst( substr( $days[$d], 0, 3 ) ); ?></td>
										<td><input name="hours[<?php echo $d ?>][open][]" class="timepick" type="text"></td>
										<td>to</td>
										<td><input name="hours[<?php echo $d ?>][close][]" class="timepick" type="text"></td>
										<td>
											<select name="hours[<?php echo $d ?>][appt][]">
												<option value="0"><?php _e( 'No', 'inventory-presser' ); ?></option>
												<option value="1"><?php _e( 'Yes', 'inventory-presser' ); ?></option>
											</select>
										</td>
									</tr><?php

									}

									?></tbody>
							</table>

						</div>
						<div class="repeat-buttons">
							<span class="dashicons dashicons-menu repeat-move"></span>
							<span class="dashicons dashicons-trash repeat-delete"></span>
						</div>
					</div>
					<p class="description"><?php _e( 'When saving multiple sets of hours for a single location, position the primary showroom hours first.', 'inventory-presser' ); ?></p>
					<p><button type="button" class="repeat-add button action"><?php _e( 'Add Hours Block', 'inventory-presser' ); ?></button></p>
				</div>
			</td>
		</tr><?php
	}