Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Adding Taxonomy to a List of Images

Started by Muut Archive 9 years ago · 2 replies · 607 views
9 years ago

I'm trying to add taxonomy to each image in a list so that I can allow the client to filter based on the taxonomy. The problem is whenever I save, it just clears the fields. I can't seem to figure out the reason why, or if it is even possible.

Here is the code I have for the blueprint of the page.

YAML
header.gallery:
  name: favorites
    type: list
    style: vertical
    label: Gallery Images
    fields:
      .tags:
        type: taxonomy
        label: PLUGIN_ADMIN.TAXONOMY
        multiple: true
        validate:
          type: array

I know that I would be able to use the selectize field type, but I would prefer to use the taxonomy list so that the client can pick from a list of already used tags.

Hopefully someone has had this problem and it is a simple error on my end.

9 years ago

'taxonomy' field is a special type that is for Pages only. You can't arbitrarily use it for custom stuff. I would simply use a commalist type:

YAML
header.gallery:
  name: favorites
    type: list
    style: vertical
    label: Gallery Images
    fields:
      .tags:
        type: selectize
        size: large
        label: Tags
        classes: fancy
        validate:
            type: commalist
9 years ago

Okay, that clears it up. I figured I'd have to go that route. Thanks!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1333 9 years ago
Archive · by Muut Archive, 9 years ago
2 924 9 years ago
Archive · by Muut Archive, 9 years ago
2 4055 9 years ago
Archive · by Muut Archive, 9 years ago
1 2933 9 years ago
Archive · by Muut Archive, 9 years ago
3 1110 9 years ago