public function findOneByIdOrSlug($idOrSlug, $allow404 = false)
    {
        if (is_numeric($idOrSlug)) {
            $content = $this->find($idOrSlug);
        } else {
            $content = $this->findOneBySlug($idOrSlug);
        }

        // If no content was found for the passed id, return the 404 page
        if (!$content && $allow404 == true) {
            $content = $this->findOneBySlug('404');
        }

        return $content;
    }
public function findOneByIdOrSlug($idOrSlug, $allow404 = false)
    {
        if (is_numeric($idOrSlug)) {
            $content = $this->find($idOrSlug);
        } else {
            $content = $this->findOneBySlug($idOrSlug);
        }

        // If no content was found for the passed id, return the 404 page
        if (!$content && $allow404 == true) {
            $content = $this->findOneBySlug('404');
        }

        return $content;
    }
public function findOneByIdOrSlug ( $ idOrSlug , $ allow404 = false ) { if ( is_numeric ( $ idOrSlug ) ) { $ content = $ this -> find ( $ idOrSlug ) ; } else { $ content = $ this -> findOneBySlug ( $ idOrSlug ) ; } // If no content was found for the passed id, return the 404 page if ( ! $ content && $ allow404 == true ) { $ content = $ this -> findOneBySlug ( '404' ) ; } return $ content ; }
Finds a content item by its id or slug.

When $allow404 is set to true, it will look for a 404 page

@param int|string $idOrSlug
@param bool       $allow404

@return null|object|ContentInterface
Finds a content item by its id or slug .