-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5078 from neos/5077-documentUriPlaceholders
Implement document uri path placeholders
- Loading branch information
Showing
6 changed files
with
215 additions
and
48 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
Neos.Neos/Classes/FrontendRouting/Projection/DocumentTypeClassification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Neos.Neos package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\FrontendRouting\Projection; | ||
|
||
use Neos\ContentRepository\Core\NodeType\NodeTypeManager; | ||
use Neos\ContentRepository\Core\NodeType\NodeTypeName; | ||
use Neos\Neos\Domain\Service\NodeTypeNameFactory; | ||
|
||
/** | ||
* @internal is subject to change and may be removed / refactored beyond recognition at any time | ||
*/ | ||
enum DocumentTypeClassification | ||
{ | ||
/** | ||
* Satisfied if a node type is an actual document, meaning explicitly no shortcut or site | ||
*/ | ||
case CLASSIFICATION_DOCUMENT; | ||
|
||
/** | ||
* Satisfied if a node type is a shortcut | ||
*/ | ||
case CLASSIFICATION_SHORTCUT; | ||
|
||
/** | ||
* Satisfied if a node type is a site | ||
*/ | ||
case CLASSIFICATION_SITE; | ||
|
||
/** | ||
* Satisfied if a node type is neither of the above | ||
*/ | ||
case CLASSIFICATION_NONE; | ||
|
||
/** | ||
* Satisfied if a node type does no longer exist and we can't be certain | ||
*/ | ||
case CLASSIFICATION_UNKNOWN; | ||
|
||
public static function forNodeType(NodeTypeName $nodeTypeName, NodeTypeManager $nodeTypeManager): self | ||
{ | ||
$nodeType = $nodeTypeManager->getNodeType($nodeTypeName); | ||
if ($nodeType === null) { | ||
return self::CLASSIFICATION_UNKNOWN; | ||
} | ||
|
||
if ($nodeType->isOfType(NodeTypeNameFactory::forSite())) { | ||
return self::CLASSIFICATION_SITE; | ||
} elseif ($nodeType->isOfType(NodeTypeNameFactory::forShortcut())) { | ||
return self::CLASSIFICATION_SHORTCUT; | ||
} elseif ($nodeType->isOfType(NodeTypeNameFactory::forDocument())) { | ||
return self::CLASSIFICATION_DOCUMENT; | ||
} | ||
|
||
return self::CLASSIFICATION_NONE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.