1

Scenario:

There is an existing Listing component which displays the selected list of "article items".


Change Request:

Client now wants that the "News item" or other pages should be selectable as well

(Note: Articles and news are created based on helix principle where the interface templates are under templates/feature/articles ; feature/news and the listing component is under renderings/feature/articles. Page templates are in the Project layer.)


Problem:

In order to fetch the Title of News item I need the field ID of the News item. But it is stored in a different feature (feature/news) and features should not depend on each other (as per helix).

I am not sure how to proceed further in order to display items of other templates in the Listing component.

4
  • Can you not just genericise your component naming and abstract the templates to a Foundation module which is referenced by both Features?
    – sitecorium
    Jun 10, 2019 at 10:14
  • helix.sitecore.net/principles/templates/references.html ..."The practice of referencing different fields across modules by their shared name – an equivalence to duck typing – is discouraged. Note Duck Typing “If it walks like a duck and it quacks like a duck, then it is a duck” " Jun 10, 2019 at 10:18
  • are the listing presentation different across articles and news items? Jun 11, 2019 at 14:00
  • @ArtsemPrashkovich : Listing was specific for news but later was required to support article item but the Component view and behaviour is still the same Jun 11, 2019 at 14:11

1 Answer 1

4

It sounds like your Listing component does not belong in the Articles module, if it needs to display more than just Article items. Similar to how you would implement a Navigation component, the Listing component should have an associated interface template (e.g. _ListingItem) which defines the field(s) needed for the Listing. This interface template can be used by any Page types which may be listed, including Articles and News. The dependency thus flows to the Project layer, and not between Features.

This component and template could be in their own module, or perhaps in an existing "Basic Components" or "Navigation" module. Perhaps the component could even reuse an existing _Navigable interface template and its fields(s) if you have one?

More info on Interface Templates can be found in the Helix documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.