-
-
Notifications
You must be signed in to change notification settings - Fork 5
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 #19 from Sebobo/feature/noderesult-commandbar-inte…
…gration FEATURE: Improved node result commandbar integration
- Loading branch information
Showing
14 changed files
with
608 additions
and
4,133 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
22 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Shel\Neos\Terminal\Domain\Dto; | ||
|
||
use Neos\ContentRepository\Domain\Model\NodeInterface; | ||
use Neos\Flow\Annotations as Flow; | ||
|
||
#[Flow\Proxy(false)] | ||
class NodeResult implements \JsonSerializable | ||
{ | ||
|
||
private function __construct( | ||
public readonly string $identifier, | ||
public readonly string $label, | ||
public readonly string $nodeType, | ||
public readonly string $icon, | ||
public readonly string $breadcrumb, | ||
public readonly string $uri, | ||
public readonly string $score = '', | ||
) { | ||
} | ||
|
||
public static function fromNode(NodeInterface $node, string $uri, mixed $score = ''): self | ||
{ | ||
$breadcrumbs = []; | ||
$parent = $node->getParent(); | ||
while ($parent) { | ||
if ($parent->getNodeType()->isOfType('Neos.Neos:Document')) { | ||
$breadcrumbs[] = $parent->getLabel(); | ||
} | ||
$parent = $parent->getParent(); | ||
} | ||
|
||
return new self( | ||
$node->getIdentifier(), | ||
$node->getLabel(), | ||
$node->getNodeType()->getLabel(), | ||
$node->getNodeType()->getConfiguration('ui.icon') ?? 'question', | ||
implode(' / ', array_reverse($breadcrumbs)), | ||
$uri, | ||
$score, | ||
); | ||
} | ||
|
||
/** | ||
* @return array{__typename: string, identifier: string, label: string, nodeType: string, icon: string, breadcrumb: string, uri: string, score: float} | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'__typename' => 'NodeResult', | ||
'identifier' => $this->identifier, | ||
'label' => $this->label, | ||
'nodeType' => $this->nodeType, | ||
'icon' => $this->icon, | ||
'breadcrumb' => $this->breadcrumb, | ||
'uri' => $this->uri, | ||
'score' => $this->score, | ||
]; | ||
} | ||
|
||
/** | ||
* @return array{__typename: string, identifier: string, label: string, nodeType: string, icon: string, breadcrumb: string, uri: string, score: float} | ||
*/ | ||
public function jsonSerialize(): array | ||
{ | ||
return $this->toArray(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,5 +37,3 @@ | |
left: 0; | ||
} | ||
|
||
|
||
/*# sourceMappingURL=Plugin.css.map*/ |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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.