Skip to content

Commit

Permalink
TASK: Remove NodeLabel functionality again (merge #5020)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 14, 2024
1 parent 3af6cdb commit 5e04763
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ private function loadNodeType(string $nodeTypeName, array &$completeNodeTypeConf
$nodeType = new NodeType(
NodeTypeName::fromString($nodeTypeName),
$superTypes,
$nodeTypeConfiguration,
$this->nodeLabelGeneratorFactory
$nodeTypeConfiguration
);

$this->cachedNodeTypes = $this->cachedNodeTypes->with($nodeType);
Expand Down
10 changes: 0 additions & 10 deletions Neos.ContentRepository.Core/Classes/NodeType/NodeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

use Neos\ContentRepository\Core\NodeType\Exception\TetheredNodeNotConfigured;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
use Neos\ContentRepository\Core\SharedModel\Node\PropertyName;

Expand Down Expand Up @@ -45,7 +44,6 @@ private function __construct(
public NodeTypeConstraints $childNodeTypeConstraints,
public array $metadata,
public NodeTypeLabel|null $label,
private NodeLabelGeneratorInterface|null $nodeLabelGenerator,
) {
}

Expand Down Expand Up @@ -139,14 +137,6 @@ public function getOptions(): array
return $this->metadata['options'] ?? [];
}

/**
* Return the node label generator class for the given node
*/
public function renderNodeLabel(Node $node): string
{
return $this->nodeLabelGenerator !== null ? $this->nodeLabelGenerator->getLabel($node) : \mb_substr($node->nodeTypeName->value, \mb_strrpos($node->nodeTypeName->value, '.') + 1);
}

/**
* Return the array with the defined properties. The key is the property name,
* the value the property configuration. There are no guarantees on how the
Expand Down
19 changes: 1 addition & 18 deletions Neos.ContentRepository.Core/Classes/NodeType/NodeTypeLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
*/
final class NodeTypeLabel implements \JsonSerializable
{
public const ROOT_NODE_TYPE_NAME = 'Neos.ContentRepository:Root';

/**
* @var array<string,self>
*/
private static array $instances = [];

private function __construct(
public readonly string $value
) {
Expand All @@ -36,19 +29,9 @@ private function __construct(
}
}

private static function instance(string $value): self
{
return self::$instances[$value] ??= new self($value);
}

public static function fromString(string $value): self
{
return self::instance($value);
}

public function equals(self $other): bool
{
return $this === $other;
return new self($value);
}

public function jsonSerialize(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use Neos\ContentRepository\Core\NodeType\ConstraintCheck;
use Neos\ContentRepository\Core\NodeType\Exception\TetheredNodeNotConfigured;
use Neos\ContentRepository\Core\NodeType\NodeLabelGeneratorFactoryInterface;
use Neos\ContentRepository\Core\NodeType\NodeType;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\NodeType\NodeTypeNames;
Expand Down Expand Up @@ -54,7 +53,6 @@ final class NodeTypeProvider implements NodeTypeProviderInterface

public function __construct(
private readonly ConfigurationManager $configurationManager,
private readonly NodeLabelGeneratorFactoryInterface $nodeLabelGeneratorFactory
) {
}

Expand Down Expand Up @@ -341,8 +339,7 @@ private function loadNodeType(string $nodeTypeName, array &$completeNodeTypeConf
$nodeType = new NodeType(
NodeTypeName::fromString($nodeTypeName),
$superTypes,
$nodeTypeConfiguration,
$this->nodeLabelGeneratorFactory
$nodeTypeConfiguration
);

$this->cachedNodeTypes[$nodeTypeName] = $nodeType;
Expand Down

0 comments on commit 5e04763

Please sign in to comment.