Raniel Quirante
Raniel Quirante

Reputation: 431

Orchard Core CMS - Is it possible to get an existing content item, to be shown in another content item?

I've been struggling to show an existing content item to a another content item, what I can do as of now is just add the content part in a content item with using Flow and Bag, but the user really has to fill up the fields for these stuff. What I am trying to do here is for example make a styled 'button' (with the tags and such) with prefilled text in the button, then the user can edit it anytime within the content item it is called.

I am using orchard core with .net core 5.0

Upvotes: 0

Views: 1106

Answers (1)

NZWiztek
NZWiztek

Reputation: 26

There are multiple ways to do this, the way I like to do it for styling is to make a content part with different fields, usually text fields and once the field is created, edit the field and change the editor type to predefined list, once this predefined list is created, one of them can be selected as default. Then add this content part as a part on the parent content type image of fields on contentpart image of predefined list

Another way would be to create a content picker field on an item, that's how you can include other content types on a parent item, I find this approach good for bigger content items (I.e. contentbanners etc) content banner content picker image

This approach is good but you have to use the contentitem filter (Liquid or razor) to get the content item as the parent content item only includes a reference to the content item and not the actual item.

{% for ContentItemId in Model.ContentItem.Content.ContentSections.Banners.ContentItemIds %}
    {% assign contentSection = ContentItemId | content_item_id | shape_build_display: "Detail" %}
    {{ contentSection | shape_render }}
{% endfor %}

The Third way, if you want content creators to add buttons etc in html editors etc would be via using shortcodes. shortcodes

Upvotes: 1

Related Questions