Is your feature request related to a problem? Please describe.
I was trying to turn my art shortcode into a snippet and thought it would be useful to be able to use the media snippet feature, especially since most of the fields for that shortcode are captured in the existing details for media files. In my case, I need two fields that aren't available for media files: extra classes to apply (which will always be context specific, not part of the details for the media file itself) and a content warning (which should always be used for that media and belongs in the media's details, if possible).
However, if I want to take advantage of the (extremely good!) functionality for media snippets, I can't define any extra fields for the snippet beyond the placeholders, as far as I can tell, and I would have to respecify the content warning every time I wanted to use the snippet, which could lead to drifting verbiage.
Describe the solution you'd like
I would like to be able to use media placeholders alongside custom inputs for media snippets and extend the details I can supply for media files in general.
If I could specify a snippet like this:
"Art":{"description":"Add art as a figure with an optional content warning.","body":"{{< art src=\"[[&mediaUrl]]\" alt=\"[[&alt]]\" class=\"[[classes]]\" content_warning=\"[[&contentWarning]]\" />}}","isMediaSnippet":true,"fields":[{"name":"classes","title":"Class List: Specify any classes to add to the block in a space separated list.","type":"string","single":true,"default":""}]}
And a setting in frontmatter.json (example name, probably not a good one) like this:
Then when I select the Art media snippet, it would prompt me with a modal for the non-details fields (in this case, just classes) and otherwise work as the current ones do.
Describe alternatives you've considered
I could define a data set for my media which includes the content warning and always reference that (though snippets don't yet support this, I think). I could define a normal snippet and lose the media selection/automatic placeholders, which is still better than hand-authoring the shortcode, but not nearly as good as the UX for media snippets.
Additional context
N/A
**Is your feature request related to a problem? Please describe.**
I was trying to turn my [art shortcode][01] into a snippet and thought it would be useful to be able to use the media snippet feature, especially since _most_ of the fields for that shortcode are captured in the existing details for media files. In my case, I need two fields that aren't available for media files: extra classes to apply (which will always be context specific, not part of the details for the media file itself) and a content warning (which _should_ always be used for that media and belongs in the media's details, if possible).
However, if I want to take advantage of the (extremely good!) functionality for media snippets, I _can't_ define any extra fields for the snippet beyond the placeholders, as far as I can tell, and I would have to respecify the content warning every time I wanted to use the snippet, which could lead to drifting verbiage.
**Describe the solution you'd like**
I would like to be able to use media placeholders alongside custom inputs for media snippets and extend the details I can supply for media files in general.
If I could specify a snippet like this:
```json
"Art": {
"description": "Add art as a figure with an optional content warning.",
"body": "{{< art src=\"[[&mediaUrl]]\" alt=\"[[&alt]]\" class=\"[[classes]]\" content_warning=\"[[&contentWarning]]\" />}}",
"isMediaSnippet": true,
"fields": [
{
"name": "classes",
"title": "Class List: Specify any classes to add to the block in a space separated list.",
"type": "string",
"single": true,
"default": ""
}
]
}
```
And a setting in `frontmatter.json` (example name, probably not a good one) like this:
```json
"frontMatter.media.extraDetailFields": [
{
"title": "Content Warning",
"name": "contentWarning",
"type": "string",
"single": false
}
]
```
Then when I select the `Art` media snippet, it would prompt me with a modal for the non-details fields (in this case, just classes) and otherwise work as the current ones do.
**Describe alternatives you've considered**
I could define a data set for my media which includes the content warning and always reference that (though snippets don't yet support this, I think). I could define a normal snippet and lose the media selection/automatic placeholders, which is _still better_ than hand-authoring the shortcode, but not nearly as good as the UX for media snippets.
**Additional context**
N/A
[01]: https://github.com/platenio/hugo-platen/blob/main/layouts/shortcodes/art.html
<!-- github-sync-id:1360957593 -->
Thanks, @michaeltlombardi, for the suggestion. This makes sense to bring the functionality from normal snippets over to media snippets + have some further enhancements as you suggest with the warnings.
Thanks, @michaeltlombardi, for the suggestion. This makes sense to bring the functionality from normal snippets over to media snippets + have some further enhancements as you suggest with the warnings.
<!-- github-comment-id:1236626445 -->
Good news, I have just implemented this enhancement, enabling you to use extra fields in your media snippets. If none are defined, it works like before, but when you define custom fields for your snippet, it will open the form.
Info: the media placeholders will also appear as a field that can be modified. This is intentional, so you have the option to override its value.
Good news, I have just implemented this enhancement, enabling you to use extra fields in your media snippets. If none are defined, it works like before, but when you define custom fields for your snippet, it will open the form.

> **Info**: the media placeholders will also appear as a field that can be modified. This is intentional, so you have the option to override its value.
<!-- github-comment-id:1242164387 -->
@estruyf confirmed working in latest beta! This is incredibly good!
@estruyf confirmed working in latest beta! This is _incredibly_ good!

<!-- github-comment-id:1242792961 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Is your feature request related to a problem? Please describe.
I was trying to turn my art shortcode into a snippet and thought it would be useful to be able to use the media snippet feature, especially since most of the fields for that shortcode are captured in the existing details for media files. In my case, I need two fields that aren't available for media files: extra classes to apply (which will always be context specific, not part of the details for the media file itself) and a content warning (which should always be used for that media and belongs in the media's details, if possible).
However, if I want to take advantage of the (extremely good!) functionality for media snippets, I can't define any extra fields for the snippet beyond the placeholders, as far as I can tell, and I would have to respecify the content warning every time I wanted to use the snippet, which could lead to drifting verbiage.
Describe the solution you'd like
I would like to be able to use media placeholders alongside custom inputs for media snippets and extend the details I can supply for media files in general.
If I could specify a snippet like this:
And a setting in
frontmatter.json(example name, probably not a good one) like this:Then when I select the
Artmedia snippet, it would prompt me with a modal for the non-details fields (in this case, just classes) and otherwise work as the current ones do.Describe alternatives you've considered
I could define a data set for my media which includes the content warning and always reference that (though snippets don't yet support this, I think). I could define a normal snippet and lose the media selection/automatic placeholders, which is still better than hand-authoring the shortcode, but not nearly as good as the UX for media snippets.
Additional context
N/A
Thanks, @michaeltlombardi, for the suggestion. This makes sense to bring the functionality from normal snippets over to media snippets + have some further enhancements as you suggest with the warnings.
Good news, I have just implemented this enhancement, enabling you to use extra fields in your media snippets. If none are defined, it works like before, but when you define custom fields for your snippet, it will open the form.
@estruyf confirmed working in latest beta! This is incredibly good!
Great 😍 - think I'll use this feature a lot as well!