valid() public method

Whether this Pod object is valid or not
Since: 2.0
public valid ( ) : boolean
return boolean
Exemplo n.º 1
0
/**
 * Include and Init the Pods class
 *
 * @see Pods
 *
 * @param string $type The pod name
 * @param mixed $id (optional) The ID or slug, to load a single record; Provide array of $params to run 'find'
 * @param bool $strict (optional) If set to true, return false instead of an object if the Pod doesn't exist
 *
 * @return bool|\Pods
 * @since 2.0
 * @link http://pods.io/docs/pods/
 */
function pods($type = null, $id = null, $strict = null)
{
    require_once PODS_DIR . 'classes/Pods.php';
    $pod = new Pods($type, $id);
    if (null === $strict) {
        $strict = pods_strict();
    }
    if (true === $strict && null !== $type && !$pod->valid()) {
        return false;
    }
    return $pod;
}