init() public static method

Singleton handling for a basic pods_data() request
Since: 2.3.5
public static init ( string $pod = null, integer $id, boolean $strict = true ) : PodsData
$pod string Pod name
$id integer Pod Item ID
$strict boolean If true throws an error if a pod is not found.
return PodsData
Esempio n. 1
0
/**
 * Include and Init the PodsData class
 *
 * @see PodsData
 *
 * @param string|\Pod $pod The pod object to load
 * @param int $id (optional) Id of the pod to fetch
 * @param bool $strict (optional) If true throw an error if the pod does not exist
 * @param bool $unique (optional) If true always return a unique class
 *
 * @return PodsData
 *
 * @since 2.0
 */
function pods_data($pod = null, $id = null, $strict = true, $unique = true)
{
    require_once PODS_DIR . 'classes/PodsData.php';
    if ($unique && false !== $pod) {
        return new PodsData($pod, $id, $strict);
    }
    return PodsData::init($pod, $id, $strict);
}