JUST A SUPER EARLY DRAFT
Are you ready for it?
PackageFactory:
ComponentFactory:
autoInclude:
'nodetypes://Neos.Demo/**/*.php': true
NodeTypes/Content/Headline/Headline.php
<?php
use PackageFactory\ComponentFactory\Application\RenderingStuff;
use PackageFactory\ComponentFactory\Application\Component;
return #[Component('Neos.Demo:Content.Headline')] function(RenderingStuff $renderingStuff): string
{
return $renderingStuff->node->getProperty('title');
};
Let the battle begin.
<?php
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use PackageFactory\ComponentFactory\Application\Component;
use YourVendor\Site\Presentation\Headline;
return #[Component('Neos.Demo:Content.Headline')] function(RenderingStuff $renderingStuff): Headline
{
return new Headline(
content: $renderingStuff->node->getProperty('title')
)
};
The annotation #[Component('Neos.Demo:Content.Headline')]
behaves similar to the Neos.Neos:ContentComponent
, as it will genrate the necessary markup to make the content editable.
For inline editable properties, you can use the helper function:
use function PackageFactory\ComponentFactory\Application\editable;
$content = editable(
renderingStuff: $renderingStuff,
property: 'title',
block: false
);
To ease the migration to the ComponentEngine you can leverage PackageFactory.FusionFactory to reuse your existing Presentational components written in Fusion + AFX.
the equivalent of this fusion integration
prototype(Neos.Demo:Content.Headline) < prototype(Neos.Neos:ContentComponent) {
tagName = ${q(node).property('tagName')}
tagStyle = ${q(node).property('tagStyle')}
content = Neos.Neos:Editable {
property = 'title'
block = false
}
renderer = afx`<Neos.Demo:Presentation.Headline {...props} />`
}
would be:
<?php
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use PackageFactory\ComponentFactory\Application\Component;
use function PackageFactory\ComponentFactory\Application\editable;
use function PackageFactory\FusionFactory\Application\fusionComponent;
use function PackageFactory\FusionFactory\Application\h;
return fusionComponent(#[Component('Neos.Demo:Content.Headline')] function(RenderingStuff $renderingStuff)
{
$node = $renderingStuff->node;
$tagName = $node->getProperty('tagName');
$tagStyle = $node->getProperty('tagStyle');
$content = editable(
renderingStuff: $renderingStuff,
property: 'title',
block: false
);
return h(
type: 'Neos.Demo:Presentation.Headline',
props: compact('tagName', 'tagStyle', 'content')
);
});