New answers tagged media
0
I did with javascript because the field type media_library is not an actual input field.
I overrided the setMediaUploadFieldValue jQuery function of the media_library_form_element module.
(($, Drupal) => {
Drupal.behaviors.VideoComponent = {
attach: () => {
$.fn.setMediaUploadFieldValue = (data, element) => {
const mediaElement = ...
1
In response to your second question, there is a core issue open regarding editing media items within the field widget: https://www.drupal.org/project/drupal/issues/2985168
There is also a contrib module Media Library Edit.
One problem is that you will edit the media entity itself, affecting all usages of the media item.
0
but node is null since this is not on a node
In user template there is {{ user }} variable wich holds user entity. So just replace "node" with "user" in your snippets.
0
You can upload images and create media without the File Entity module and any module fixes.
Try this:
New "file_upload" REST resource plugin: allows file uploads of any size, creates File entities
In your case, the request would be like this:
POST /file/upload/media/image/field_media_image?_format=hal_json HTTP/1.1
Content-Type: application/octet-...
Top 50 recent answers are included
Related Tags
media × 26887 × 859
8 × 387
files × 378
theming × 304
views × 297
entities × 290
nodes × 221
javascript × 121
wysiwyg × 116
users × 97
forms × 84
6 × 80
uri × 56
blocks × 54
migration × 49
navigation × 38
taxonomy-terms × 37
hooks × 35
caching × 23
feeds × 23
ajax × 22
rules × 19
database × 18
tokens × 17