Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Allow to preview non-site packages #101

Open
kdambekalns opened this issue Mar 26, 2019 · 2 comments
Open

FEATURE: Allow to preview non-site packages #101

kdambekalns opened this issue Mar 26, 2019 · 2 comments

Comments

@kdambekalns
Copy link
Contributor

I am building a component library in it's own package. That package is not a neos-site, but a simple neos-package. As such it does not appear in the package selector in Monocle.

Since offering all packages is useless and checking all packages for potentially providing components, I'd suggest a way to register packages for inclusion through Monocle's settings.

@bwaidelich
Copy link
Contributor

FYI: This one is related to #109 and #110 slightly

@bwaidelich
Copy link
Contributor

I had a quick look, but this would probably require a bigger change since the PackageKeyTrait is used in quite a few places.
I got it to work for our case with a little AOP aspect (in case someone else needs this):

<?php
declare(strict_types=1);
namespace Some\Package\Aspects;

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Aop\JoinPointInterface;

/**
 * @Flow\Aspect
 */
final class MonoclePackageKeyTraitAspect
{

    /**
     * Aspect that prepends the active site package list with "Some.Package" so that this package appears in the
     * site selector of the Monocle Preview
     *
     *
     * @Flow\Around("method(Sitegeist\Monocle\Controller\ApiController->getActiveSitePackageKeys())")
     * @param JoinPointInterface $joinPoint
     * @return array
     */
    public function addPackageToActiveSitePackageKeys(JoinPointInterface $joinPoint): array
    {
        $activeSitePackages = $joinPoint->getAdviceChain()->proceed($joinPoint);
        array_unshift($activeSitePackages, 'Some.Package');
        return $activeSitePackages;
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants