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

Add image variants viewer #136

Merged
merged 13 commits into from
Sep 7, 2022
Merged

Conversation

suffle
Copy link

@suffle suffle commented Jul 28, 2022

This PR adds the possibility to view image variants as a foundation to implement the variant editing as well.

To test the feature, you need to configure image variant presets as described here.

You also need to enable the variants editor by setting

Neos:
  Neos:
    Ui:
      frontendConfiguration:
        Flowpack.Media.Ui:
          showVariantsEditor: true

@suffle suffle force-pushed the feature/add-image-variants branch 2 times, most recently from 446303c to 39d4a4b Compare July 28, 2022 13:58
@suffle suffle force-pushed the feature/add-image-variants branch from 39d4a4b to adbec9a Compare July 28, 2022 14:08
@Sebobo Sebobo self-requested a review July 29, 2022 11:01
Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome change, thx!

Left some questions 🙂

Classes/GraphQL/Resolver/Type/AssetVariantResolver.php Outdated Show resolved Hide resolved
public function assetVariants($_, array $variables, AssetSourceContext $assetSourceContext): array
{
$assetProxy = $this->asset($_, $variables, $assetSourceContext);
if ($assetProxy === null || !($assetProxy instanceof NeosAssetProxy) || !($assetProxy->getAsset() instanceof VariantSupportInterface)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the check here for the NeosAssetProxy if we already check for the interface?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't really know, I took that from https://github.com/neos/neos-development-collection/blob/master/Neos.Media.Browser/Classes/Controller/AssetController.php#L421 and it made sense to me to check if assetProxy is a NeosAssetProxy and so has the method getAsset, before calling it. But i am not proficient enough in the neos asset handling to judge if it is really necessary

Resources/Private/GraphQL/schema.root.graphql Outdated Show resolved Hide resolved
@Sebobo
Copy link
Member

Sebobo commented Aug 8, 2022

Should we then call this PR variant viewer for now and add the editor in a separate PR?

@suffle suffle changed the title Add image variants editor Add image variants viewer Aug 12, 2022
@Sebobo
Copy link
Member

Sebobo commented Sep 1, 2022

Thx for the changes, should I then make the final review and we can merge if it's fine?

@suffle
Copy link
Author

suffle commented Sep 5, 2022

Sounds good to me, I have plans to add the editing feature this week, but that depends on my workload, no need to block this PR

@Sebobo Sebobo merged commit 10c3fcf into Flowpack:master Sep 7, 2022
@Sebobo Sebobo deleted the feature/add-image-variants branch September 7, 2022 15:24
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

Successfully merging this pull request may close these issues.

2 participants