Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "netlogix/neos-content",
"description": "This plugin enables Shopware templates to be designed with an Enterprise CMS.",
"version": "0.1.26",
"version": "0.1.27",
"type": "shopware-platform-plugin",
"license": "MIT",
"autoload": {
Expand Down
8 changes: 4 additions & 4 deletions src/Core/Content/NeosNode/NeosNodeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\DateField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\FkField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required;
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToOneAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ReferenceVersionField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\VersionField;
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;

Expand All @@ -36,13 +36,13 @@ protected function defineFields(): FieldCollection
{
return new FieldCollection([
new VersionField(),
((new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey())),
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey(), new ApiAware()),
(new DateField('created_at', 'createdAt')),
(new DateField('updated_at', 'updatedAt')),
(new BoolField('neos_connection', 'neosConnection')),
(new BoolField('neos_connection', 'neosConnection'))->addFlags(new ApiAware()),
(new FkField('cms_page_id', 'cmsPageId', CmsPageDefinition::class))->addFlags(new Required()),
(new ReferenceVersionField(CmsPageDefinition::class, 'cms_page_version_id')),
(new OneToOneAssociationField('cmsPage', 'cms_page_id', 'id', CmsPageDefinition::class, false)),
(new OneToOneAssociationField('cmsPage', 'cms_page_id', 'id', CmsPageDefinition::class, false))->addFlags(new ApiAware()),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
use nlxNeosContent\Core\Content\NeosNode\NeosNodeDefinition;
use Shopware\Core\Content\Cms\CmsPageDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\EntityExtension;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToOneAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

class CmsPageDefinitionExtension extends EntityExtension
{
public function extendFields(FieldCollection $collection): void
{
$collection->add(
new OneToOneAssociationField('nlxNeosNode', 'id', 'cms_page_id', NeosNodeDefinition::class, true)
(new OneToOneAssociationField(
'nlxNeosNode', 'id', 'cms_page_id', NeosNodeDefinition::class, true
))->addFlags(new ApiAware())
);
}

Expand Down
5 changes: 5 additions & 0 deletions src/Listener/NavigationLoadedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use nlxNeosContent\Factory\NeosPageTreeItemFactory;
use nlxNeosContent\Neos\Endpoint\AbstractNeosPageTreeLoader;
use nlxNeosContent\Service\ConfigService;
use Shopware\Core\Content\Category\Event\NavigationLoadedEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

Expand All @@ -15,11 +16,15 @@
public function __construct(
private AbstractNeosPageTreeLoader $neosPageTreeLoader,
private NeosPageTreeItemFactory $neosPageTreeItemFactory,
private ConfigService $configService,
) {
}

public function __invoke(NavigationLoadedEvent $navigationLoadedEvent): void
{
if (!$this->configService->isEnabled()) {
return;
}
$navigation = $navigationLoadedEvent->getNavigation();
$tree = $navigation->getTree();

Expand Down
2 changes: 1 addition & 1 deletion src/Service/ConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(

public function isEnabled(?string $salesChannelId = null): bool
{
return $this->getBaseUrl($salesChannelId) !== null;
return !empty($this->getBaseUrl($salesChannelId));
}

/**
Expand Down