3

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.

Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
  • 1
    Do you have something else in your placement overriding those ones you posted? – Hazza Jul 30 '14 at 02:37
  • @Hazza Nope. I think, though, that it's impossible to override the placement.info that is in Orchard.Fields unless we do it from the Theme. – Shaun Luttin Jul 30 '14 at 03:19
  • 1
    Agree with Hazza. What you posted should work. I've done it many times. Something else is taking precedence. Can you post your entire placement file? – joshb Jul 30 '14 at 17:54
  • 2
    I learned courtesy of Zoltan that the placement.info in Orchard.Fields probably has higher precedence than the one in my module. Apparently, I need to add a Dependencies field to my module.txt file, to make sure that my module's placement.info takes precedence over the Orchard.Fields placement.info file. Whether that's a good idea or not is a different question. See also http://docs.orchardproject.net/Documentation/manifest-files – Shaun Luttin Jul 30 '14 at 19:40

1 Answers1

2

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

kaveman
  • 4,339
  • 25
  • 44