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

Missing "Meta" on Image-Gallery #28

Open
aequi42 opened this issue Feb 12, 2019 · 2 comments
Open

Missing "Meta" on Image-Gallery #28

aequi42 opened this issue Feb 12, 2019 · 2 comments

Comments

@aequi42
Copy link
Contributor

aequi42 commented Feb 12, 2019

Hi,

I'm using a meta field on images inside an gallery:

{
    "fields": {
        "Name": {
            "name": "Name",
            "type": "text",
            "localize": false,
            "options": []
        },
        "Images": {
            "name": "Images",
            "type": "gallery",
            "localize": false,
            "options": {
                "meta": {
                    "title": {
                        "type": "markdown",
                        "label": "Title"
                    }
                }
            }
        }
    },
    "entries": [
        {
            "Name": "Live",
            "Images": [
                {
                    "meta": {
                        "title": "Vielen Dank an [Max Mustermann](https://foo-bar.com/) für dieses Bild",
                        "asset": "5c27d2256466375024000148"
                    },
                    "path": "/storage/uploads/2018/12/29/5c27d22528c3bsvarta-faran-24.jpg"
                },
                {
                    "meta": {
                        "title": "Vielen Dank an [Max Mustermann](https://foo-bar.com/) für dieses Bild",
                        "asset": "5c27d2246466375024000141"
                    },
                    "path": "/storage/uploads/2018/12/29/5c27d224935c9svarta-faran-21.jpg"
                }
            ],
            "_mby": "5c1fa17d6466377043000010",
            "_by": "5c1fa17d6466377043000010",
            "_modified": 1549904496,
            "_created": 1546113589,
            "_id": "5c27d23564663751760002c4"
        }
    ],
    "total": 1
}

The model is defined as follows:

grafik

However, in my Query I get the following error:

error GraphQL Error Unknown field `meta` on type `image_2`

  file: D:/[path-to-file]/index.js


  20 |           fields {
  21 |             slug
  22 |           }
  23 |           Image {
> 24 |             meta {
     |             ^
  25 |               title
  26 |             }
  27 |             value {
  28 |               childImageSharp {

Are you aware of this issue? I'm not complaining about the missing support for markdown inside the meta-element, but about the complete absence of it.

If this is a new issue, I'd be happy to help out, but need a little pointer into the right direction where to begin :)

@DigitalGoldfish
Copy link
Collaborator

Hi,

I knew that this feature exist but the implementation currently doesn't support meta attributes; I just never used them since they are too hidden away in the UI to be useful for me.

Adding support for this might not be too difficult. Your best bet is to add a special case handling for "image" and "gallery field to the createCollectionField function and try to model the value of the image node as a set containing meta and image fields. Where the image field is the previous value of the image/gallery field and the meta is a new "set" containing the meta fields & values.

If you are successful and the data looks just like the other sets then everything else (processing of nested fields, image node creation, ...) will just work without further modification.

Hope my explanation makes some sense ;)

@aequi42
Copy link
Contributor Author

aequi42 commented Feb 15, 2019

Okay, I gave up 😅
I can't get my head around it and will change my cockpit-model to use sets instead of images and galleries with meta.
Sorry for now. Maybe I'll take on the task in the future, but changing the model is currently easier 😁

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