Suppressing display of a field in a query/projection

Topics: Customizing Orchard
Sep 13, 2012 at 11:22 PM

Hello,

I have a query and a projection 5 fields.  I would like the projection to display only 4 of the fields.  How do I suppress display of the 5th field?  thanks

Coordinator
Sep 14, 2012 at 2:27 AM

If you add a layout to the query, you can switch to property mode and control exactly what gets displayed.

Alternatively, you can use Placement to hide a field.

Sep 15, 2012 at 2:42 AM

Thanks for the response.

I tried the property mode and was able to eliminate some fields from display that way.  But, I find that content mode would serve my application better.

The ContentType is StaffContactInformation.   There are actually 2 fields in my sandbox sample, Name and PhoneNumber.  My current projection shows both. 

I was able to remove the date stamp from the projection display by putting the following statement in Placement.info in the ThemeMachine folder:

-->
<Match ContentType="StaffContactInformation">
    <Place Parts_Common_Metadata_Summary="-"/>
--> The above line removes the metadata (date/time) from the detail view of the contact information
  </Match>
-->

To get it to drop the phone number from the projection display I tried several variations of the following:

-->
<Match ContentType="StaffContactInformation">
    <Place Parts_Common_Metadata_Summary="-"/>
    <Place StaffContactInformation_PhoneNumber="-"/>
--> The above line removes the metadata (date/time) from the detail view of the contact information
  </Match>
-->

Not sure if this is leading in the right direction though.

Sep 18, 2012 at 6:29 PM

Shout out to Sipke Schoorstra (aka Skywalker) and the L.A. Code Club crew for addressing this question at the meeting last night.

The code for a placement.info file in the theme to suppress fields (as well as common metadata) is:

<Match ContentType="StaffContactInformation">
    <Place Parts_Common_Metadata_Summary="-"/>
    <Place Parts_Common_Metadata="-"/>
    <Place Fields_Common_Text-Title="-"/>
    <Place Fields_Numeric-DisplayOrder="-"/>DisplayOrder="-"/>
</Match>

For some reason, the numeric field does not include the term "Common".  Don't know why; perhaps someone can comment.

Would also be great to add some spaces between each record entry when they are arranged horizontal.   Will be looking into how to

do that.

Coordinator
Sep 18, 2012 at 9:29 PM

Because it comes from a different module. Text comes from Core/Common, whereas the others come from Orchard.Fields.

Sep 19, 2012 at 11:16 PM

thanks - that is good to know.