This project is read-only.

How to add a custom field to a blogpost body part

Topics: Customizing Orchard, Writing modules
Sep 11, 2011 at 10:21 PM

Hi all, I am thinking of creating a module that will utilize the youtube api. As I was conceptualizing, I was thinking of presentation and a question arose. Is it possible to insert a custom field inline with text in a content part? I started searching to no avail (I maybe asking the wrong question), so I am asking here. So a quick scenario would be:

The user is creating a blogpost, and wants to add several youtube video's (field) inside the body of the content.

This could be a custom tinyMce plugin or manually entered into the html. The question is how would the custom field be represented in the markup? Or is this even possible?

Now before anyone suggests simply using the supplied embed string for the video (which I have reasons for not doing that), lets change the scenario to a calander field or similar.

If I missed the answer to this somewhere, please just point me in the direction. Any help, be it examples or just another approach would be very helpfull.


Sep 12, 2011 at 7:08 PM

Really no one??

Sep 12, 2011 at 11:07 PM

We currently have the same problem with images: they get inserted with an absolute url, which is not ideal. What we'd like eventually is use the new tokens module to replace that with well... tokens instead of raw markup, with some preprocessing and some awareness for it in the editor. It's quite tricky though. Today, having an editor extension that injects the YouTube markup raw seems like your best bet. But I may be missing something.

Oct 14, 2011 at 12:14 PM
Edited Oct 14, 2011 at 12:25 PM

Can you explain a bit about creating an editor extension? Or where an example of this in Orchard?

I need to inject some inline javascript to display advertisements within the text in a content part.

Oct 15, 2011 at 7:32 AM

Look at the media picker.