Best way to add something underneath every Markdown editor field in Admin?

Hey everybody,

I would like to add something (a bit of text and some clickable characters) underneath every Markdown editor field in Admin. I see basically three ways I might achieve this:

  1. Create a new field type and add it manually via page blueprints. I don’t like this option much because I’m doing this in a plugin, and people might have their own page templates and blueprints which they’d have to modify by themselves.
  2. Change the editor field by copying the original and adding my bit in. This seems fairly simple but a little hacky to me – what if the editor field changes at some point and I don’t notice? Can I somehow just extend that original field?
  3. Use PHP to hook into the Admin pages at some point, check if there’s an editor field, and add my bit via plugin code. That might be a good way, but I’m not too sure which hook to use, or how to check if there’s an editor field…

Any ideas and pointers would be much appreciated!

1 Like

The Presentation-plugin does this for presentation.md-Pages, you could cut out what works there and use it. It does this by:

  1. Create a field specifically for the plugin.
  2. Add it via blueprints.
  3. Set the order to be below the editor.
  4. Hook into Admin to register the templates.

Of your ideas, 3 is most difficult in my estimation. It would even be easier to do that via JavaScript. 2 might have unintended consequences unless you manage to restrict it to specific Page Types. 1 is most viable, because the plugin’s fields and templates can actually be overridden, because extensions can declare priority for events.