Shaun Luttin
Shaun Luttin

Reputation: 141732

The Placement.info in my module is not hiding the DateTime field

The documentation says (emphasis added):

There are also special extensions for certain fields so that placement can be targeted at specific field instances.

Does certain fields include the DateTime, Link, and Input fields?

I am trying to hide a DateTime field named Date when it is within a NewsItem content type. Here is my placement.info. Importantly, this placement.info works from a theme but not from a module.

<Match ContentType="NewsItem">

  <!--These ones do not work.-->
  <Place Fields_Input="-" />
  <Place Fields_DateTime="-" />
  <Place Fields_DateTime-Date="-" />
  <Place Fields_Link="-" />

  <!--These ones do work-->
  <Place Parts_Title="-" />
  <Place Parts_Common_Metadata="-" />
  <Place Fields_Common_Text="-" />
  <Place Parts_Common_Body="-" />
  <Place Parts_Common_Body_Summary="-" />
  <Place Fields_MediaLibraryPicker="-" />

</Match>

Here is Shape Tracing Model for one of the Fields:

Fields_DateTime or Fields_DateTime-Date should work.

Upvotes: 3

Views: 420

Answers (1)

thekaveman
thekaveman

Reputation: 4409

I just ran into this issue so I want to elevate this comment to a proper answer, since it seems to be the key:

...the Placement.info in Orchard.Fields probably has higher precedence than the one in [a custom] module... add a Dependencies field to [the custom module's] Module.txt file, to make sure that [the custom] module's Placement.info takes precedence over the Orchard.Fields Placement.info file.

If you are trying to override shapes for display inside the admin (e.g. in SummaryAdmin mode) from within a module, make sure your Module.txt lists dependencies for the modules that generate the shapes you are trying to override.

For example, if you want to override the Fields_MediaLibraryPicker_SummaryAdmin placement, your Module.txt should have at least:

Depedencies: Orchard.MediaLibrary

Credit to @Shaun Luttin and @Piedone

Upvotes: 2

Related Questions