Inventory_Presser_Taxonomies::get_phones( int $term_id )

get_phones


Description Description

Loads phone numbers from post meta into an array.


Top ↑

Parameters Parameters

$term_id

(int) (Required) The location term ID from which to extract phones


Top ↑

Return Return

(array) An array of arrays describing phone numbers


Top ↑

Source Source

File: includes/class-taxonomies.php

	public static function get_phones( $term_id )
	{
		$phones = array();
		$term_meta = get_term_meta( $term_id );

		for( $p=1; $p<=self::LOCATION_MAX_PHONES; $p++ )
		{
			//Is there a phone number in this slot?
			if( empty( $term_meta['phone_' . $p . '_uid'][0] ) )
			{
				//No, we're done with this location
				break;
			}

			$phones[] = array(
				'uid'         => $term_meta['phone_' . $p . '_uid'][0],
				'description' => self::meta_array_value_single( $term_meta, 'phone_' . $p . '_description' ),
				'number'      => self::meta_array_value_single( $term_meta, 'phone_' . $p . '_number' ),
			);
		}
		return $phones;
	}