Tribe__Assets::get( string|array $slug = null, boolean $sort = true )

Get the Asset Object configuration.


Parameters

$slug

(string|array) (Optional) Slug of the Asset.

Default value: null

$sort

(boolean) (Optional) If we should do any sorting before returning.

Default value: true


Top ↑

Return

(array|object|null) Array of asset objects, single asset object, or null if looking for a single asset but it was not in the array of objects.


Top ↑

Source

File: src/Tribe/Assets.php

	public function get( $slug = null ) {
		uasort( $this->assets, array( $this, 'order_by_priority' ) );

		if ( is_null( $slug ) ) {
			return $this->assets;
		}

		// Prevent weird stuff here
		$slug = sanitize_title_with_dashes( $slug );

		if ( ! empty( $this->assets[ $slug ] ) ) {
			return $this->assets[ $slug ];
		}

		return null;
	}

Top ↑

Changelog

Changelog
Version Description
4.3
4.11.0 Introduced.