Orchard CMS 1.6 placement.info Order not working - orchardcms

I've just migrated a site to 1.6 - form 1.5, and I'm experiencing issues with the placement.info file in my theme,
I have the following placement
<Match DisplayType="Detail">
<Place Parts_Title="/BeforeMain:1.5"/>
</Match>
I aslo have a Bred crumb menu widget placed in Before main with a placement setting of 5
No matter what I do to the numeric placement values, the Title always appears before the bread crumbs.
I'm also experiencing other issues with the theme placement.info file anybody else getting this. any ideas ?
This works in 1.5
Update - see comments
Update 2
<Match ContentType="AlternateIndexPage">
<Place Parts_Introduction="/BeforeMain:4"/>
<Place Parts_Title="/BeforeMain:3"/>
<Place Fields_Input__AltenateIndexPage_VideoUrl="/BeforeMain:2"/>
<Math>
No matter what numbers / order I include in the palcement.info file the Video always apear first the title second and the intro third. If I use '-' the item disappear so I know the placement file is working - a bit

Widget position and placement are not the same thing unfortunately. I'm suspecting that if this worked in 1.5 it was a coincidence. Please file a bug so that this can be made to work in a future version.
A (not ideal) workaround would be to split that zone in two and send the widget to one, and the title to the other.

Related

Duplicate an orchard part

I'm trying to use Placement.info instead of overwriting a complete content template and i need to have a part (Parts_Title) displayed in the Content zone and in the Header zone. I was thinking that have two place with that Part in the Placement.info file would do the trick but it seems that the last one wins.
Is there a way to do that? I'm using Orchard 1.9.1.0
Edit 2016-03-16 following Alexander's answer:
There's something i should do wrong; i have a content type designed in the dashboard (no code) named OffreEmploi. I use Content-OffreEmploi.cshtml as the alternate. Here is the code:
#using Orchard.ContentManagement.Utilities;
#Display(Model.Header);
#Display(Model.Content);
#Display(Model.LocalZoneName);
and here is my placement.info
<Match ContentType="OffreEmploi">
<Place Fields_DateTime-DateDebut="Header:2"/>
<Place Fields_Common_Text-Duree="Header:3"/>
<Place Fields_Common_Text-Localisation="Header:4"/>
<Place Fields_Boolean-Temporaire="Header:5"/>
<Place Fields_DateTime-DateExpiration="Header:6"/>
<Place Parts_Common_Metadata="-"/>
<Place Fields_Common_Text-TexteIntroduction="Content:1"/>
<Place Parts_Title="Header:1" />
<Place Parts_Common_Body="Content:3" />
<Place Parts_Title="LocalZoneName:1" />
</Match>
the part Parts_Title is rendered only at the end (in the LocalZoneName)
You can't do this by using only placement.info. The best way for displaying content part twice is to use special local zone for that content part:
Create alternate for Content. Display a zone twice in it alternate by using #Display(Model.LocalZoneName)
Use that local zone in placement.info to render your part inside it Parts_Title="LocalZoneName:1"
Placement.info allows you to specify a single place to put your part in. This is the reason behind the behavior you see - the last entry wins (LocalZoneName:1). And this is where your part's content now resides in - the LocalZoneName.
What Alexander was actually suggesting, and what's the usual solution to this (not unusual) scenario is to use a separate, unique zone to put your part in, and render that zone multiple times, ie.:
#using Orchard.ContentManagement.Utilities;
#Display(Model.LocalZoneName);
#Display(Model.Header);
#Display(Model.LocalZoneName);
#Display(Model.Content);
This will make your LocalZoneName (which now containes the Title part) to be rendered twice - before the Header and Content zones.

Orchard CMS - How to Get Current DisplayType

I have a custom ContentPart as well as an editor view under Views/EditorTemplates/Parts/ folder. I am trying to figure out the appropriate DisplayType value to use in my placement.info file to get this view to kick in. I see it show up if I use something like this:
<Match ContentType="MyType">
<Place Parts_MyPart_Edit="Content"/>
</Match>
But I'd like to be able to target it a little more explicitly like:
<Match ContentType="MyType">
<Match DisplayType="????">-->
<Place Parts_MyPart_Edit="Content"/>
</Match>
</Match>
I have tried "Detail", "Summary", and "SummaryAdmin" unsuccessfully.
So 2 questions:
Is there a standard list of "DisplayType" values documented somewhere?
Is there a way to discover what the "DisplayType" is at runtime via a breakpoint or otherwise so that I can further restrict it in the placement.info?
Edit
Thinking about this a bit more, is 'DisplayType' even involved when Editor templates are used? I just realized that Parts_MyPart_Edit may be restrictive enough since it is already targetting _Edit. Is this right, or is there also an option to match on 'DisplayType' that can be used for editor templates?
1: Don't know exactly where the correct documentation is on this topic, but this is the correct syntax:
<Match DisplayType="Summary"> Detail and SummaryAdmin are also valid display types.
Besides that, you can also define your own display type:
var shape = _contentManager.BuildDisplay(item, "CustomDisplayType");
Then your shapes/views must be named as YourShape.CustomDisplayType.cshtml.
Then you can use your displaytype in placement.info:
<Match DisplayType="CustomDisplayType">
<Place Parts_YourPart="Content:1" />
</Match>
2: Use the 'shape tracer' module. When enabled you can find in the front-end which display type is used.
You probably made a mistake with either the <Place Parts_ section or your part driver is not correctly implemented. Also check if your shape's name is correct.
Posting this as an answer, since I don't have a high enough reputation to add comment yet :)
If you are interested in using Shape Tracer on admin pages, open up the ShapeTracingFactory.cs file in Orchard.DesignerTools module, and comment out the following line in the IsActivable method:
if (AdminFilter.IsApplied(new RequestContext(_workContext.HttpContext, new RouteData())))
return false;
I have found this extremely useful for figuring out exactly what is happening during Content Authoring tasks

Orchard Placement file not hiding the Title Part

In Orchard I have a placement.info file that should hide the Title part when I view an Author:
<Match ContentType="Author">
<Place Parts_Title="-" />
<Place Parts_Breadcrumbs="-" />
</Match>
Author is a custom content type I've created and the Breadcrumbs Part is a custom part.
The breadcrumbs part is hidden, but the title is still displayed. If I inspect it with Shape Tracing it is definitely Parts_Title I want to remove, but the content of my placement file doesn't seem to work.
I do not have a whole of example to go on there, but it seems to me that this part is conflicting with the Parts_Title that ships with orchard.
Try extending the modifier in your placement as well as your shapes to something like:
Parts_MyModule_Title
This just adds some more clarity and can keep orchard from stepping all over itself.
Similar problem here.
This is because your custom part's Placement.info was loaded first and Orchard Title part was loaded after that overriding it.
To solve it, in your custom part's Module.txt, put a dependence on Title. This will force Orchard Title to be loaded first before your custom part.

Using Orchard CMS, How do I hide items in a container content type?

I have been attempting to hide the contained items of a Page content type. I have been manipulating the placement.info file in my theme but I am not seeing the results I would expect.
Here's my bruit-force attempt:
<Match Path="/about">
<Match ContentType="Page">
<Match DisplayType="Detail">
<Place Parts_Common_ContentItems="-"/>
<Place Parts_Container_Contained="-"/>
<Place Parts_Container_Contained_Summary="-"/>
<Place Parts_Container_List="-"/>
</Match>
</Match>
</Match>
I have scoured StackOverflow for the answer and I have used the Shape Tracing module to give me direction on designing my placement.info file but I still seem to be missing something.
Any pointers are appreciated!
Thanks.
You cannot hide the content of a container using only Placement.info because the list is rendered by its own controller (Orchard.Core.Containers.Controllers.ItemController) instead of using a shape in the standard orchard shape rendering sytem.
However you may use your own (very simple) controller to build a display without this child list.
I'd say don't put it in the container if you don't want it to appear in there. You might also want to check out taxonomies, that provide a much better and flexible approach to classifying your contents.

OrchardCMS layout of admin pages

I'm trying to change the layout of the admin page for a type and I'm struggling. The client is very specific on the order of the fields and I'm not sure how to do it.
I've created an admin theme and changed the placement.info, but it doesn't seem to work. Are there any hooks I could use to accomplish this?
Any help much appreciated.
My placement.info in the admin theme.
<Match ContentType="Course">
<Place Parts_Routable_Edit="Content:1" />
<Place Fields_Contrib_TaxonomyField_Edit="Content:2" />
<Place Parts_Taxonomies_Term_Fields="Content:2.5" />
<Place Parts_MediaPickerField_Edit="Content:3" />
<Place Parts_Course_Edit="Content:4" />
<Place Parts_Tags_Edit="Content:5" />
</Match>
There's also another problem. I would like 3 taxonomies, and have them placed in different areas of the admin screen. Any idea how to do that?
Since 1.5, you can change the order of parts and fields in the editor, from the admin dashboard. Go to Content Types, select the type, then click on "Manage Placement". You can then drag and drop parts and fields around.
Note that admin themes need to contain a IThemeSelector implementation that gives it a priority of more than 100, which is the priority of the default admin theme.
It really depends on what you want to change. A lot of the admin stuff uses regular ASP MVC, so all you really need to do is override a view or a couple of shapes.
For instance, if you wanted to change how the Modules page was rendered, you could do the following:
Create the folder Views/Orchard.Modules/Admin (this matches the module/controller name) in your theme. Inside it create a view called Index.cshtml, and copy and paste the code from the same view in Orchard.Modules - now you can change your version as much as you like and it should override the default view.
For overriding shapes it is a case of just working out the shape name via the shape tracing module and then adding your own version in your Views folder.
All this is fairly generic advice though, again it really does depend on exactly what you want to change.

Resources