Bolt\Controller\Frontend::isTaxonomyValid PHP Method

isTaxonomyValid() protected method

Check if the taxonomy is valid.
See also: https://github.com/bolt/bolt/pull/2310
protected isTaxonomyValid ( Content $content, string $slug, array $taxonomy ) : boolean
$content Bolt\Legacy\Content
$slug string
$taxonomy array
return boolean
    protected function isTaxonomyValid($content, $slug, array $taxonomy)
    {
        if ($taxonomy['behaves_like'] === 'tags' && !$content) {
            return false;
        }
        $isNotTag = in_array($taxonomy['behaves_like'], ['categories', 'grouping']);
        $options = isset($taxonomy['options']) ? array_keys($taxonomy['options']) : [];
        $isTax = in_array($slug, $options);
        if ($isNotTag && !$isTax) {
            return false;
        }
        return true;
    }