public function getDocumentTypeBySlug($slug, $getBricks = false)
    {
        $documentTypes = $this->repository->documentTypes;
        foreach ($documentTypes as $documentType) {
            if ($documentType->slug == $slug) {
                if ($getBricks === true) {
                    foreach ($documentType->bricks as $key => $brick) {
                        $brickStructure = $this->getBricks()->getBrickBySlug($brick->brickSlug);
                        $documentType->bricks[$key]->structure = $brickStructure;
                    }
                    foreach ($documentType->dynamicBricks as $key => $brickSlug) {
                        $brickStructure = $this->getBricks()->getBrickBySlug($brickSlug);
                        $documentType->dynamicBricks[$key] = $brickStructure;
                    }
                }

                return $documentType;
            }
        }

        return null;
    }
public function getDocumentTypeBySlug($slug, $getBricks = false)
    {
        $documentTypes = $this->repository->documentTypes;
        foreach ($documentTypes as $documentType) {
            if ($documentType->slug == $slug) {
                if ($getBricks === true) {
                    foreach ($documentType->bricks as $key => $brick) {
                        $brickStructure = $this->getBricks()->getBrickBySlug($brick->brickSlug);
                        $documentType->bricks[$key]->structure = $brickStructure;
                    }
                    foreach ($documentType->dynamicBricks as $key => $brickSlug) {
                        $brickStructure = $this->getBricks()->getBrickBySlug($brickSlug);
                        $documentType->dynamicBricks[$key] = $brickStructure;
                    }
                }

                return $documentType;
            }
        }

        return null;
    }
public function getDocumentTypeBySlug ( $ slug , $ getBricks = false ) { $ documentTypes = $ this -> repository -> documentTypes ; foreach ( $ documentTypes as $ documentType ) { if ( $ documentType -> slug == $ slug ) { if ( $ getBricks === true ) { foreach ( $ documentType -> bricks as $ key => $ brick ) { $ brickStructure = $ this -> getBricks ( ) -> getBrickBySlug ( $ brick -> brickSlug ) ; $ documentType -> bricks [ $ key ] -> structure = $ brickStructure ; } foreach ( $ documentType -> dynamicBricks as $ key => $ brickSlug ) { $ brickStructure = $ this -> getBricks ( ) -> getBrickBySlug ( $ brickSlug ) ; $ documentType -> dynamicBricks [ $ key ] = $ brickStructure ; } } return $ documentType ; } } return null ; }
Get document type by its slug

@param      $slug
@param bool $getBricks

@return mixed
Get document type by its slug