2

How I can insert some help text on the ckeditor media embed "Create embed" tab? Oddly, I can't even find those words together in code. I have a user confused about its use, so I want to specify that this is for video URLs only. She is trying to "embed" an image that she already has on the site, but she gets an error message "input did not match any media types." If I do a form alter of "entity_embed_dialog" then the message displays on all tabs of media embed dialog window.enter image description here I have several contrib modules on the site. Any of these may/may not affect this process: embed, entity, entity_browser, entity_embed, lightning_media, video_embed_field

2
  • Can you put twitter or other embeds in that field too?
    – sonfd
    Aug 26, 2021 at 11:50
  • From a comment you left on the answer, I take the Entity Browser module has been installed. Are there other contributed modules installed on that site?
    – apaderno
    Aug 27, 2021 at 10:59

1 Answer 1

0
+50

Drupal is actually rendering the media create form for that bundle of 'embed', so that is why your alter affecting all the tabs.

What you want to do is actually edit the 'embed' media type field settings.

  1. Open up /admin/structure/media and select your 'embed' media type.
  2. Select the "Manage Fields" tab.
  3. Edit the video embed field and add some help/description text.

You can also go to "Manage form display" and see the form configuration if there are settings there you would like to adjust.

4
  • This sounded good, but it didn't display anything other than the entry textarea. I did a search for "Enter a URL..." and it's in the lightning_media module, src/Plugin/EntityBrowser/Widget/EmbedCode.php file.
    – shelane
    Aug 24, 2021 at 21:58
  • Ah yeah, core Drupal widget will render the form, whereas this module has some custom functionality. I think you are on the right track with the form alter, but that widget form is the one you want to alter. Aug 24, 2021 at 22:49
  • @shelane were you able to sort out your issue with the widget form alter? Aug 26, 2021 at 20:36
  • Not exactly, but close. I found that the right hook I need is hook_form_entity_browser_form_alter and that at least allows me to add some text to the form. I was trying with xdebug to fin the form element and maybe replace its placeholder value, but it wasn't showing the form element event though the breakpoint fired.
    – shelane
    Aug 26, 2021 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.