Uploaded image for project: 'Blossom'
  1. Blossom
  2. BLOSSOM-154

Useful Component Inheritance Use Case

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Workaround exists
    • Icon: Neutral Neutral
    • None
    • None
    • None
    • None

      A very typical use case on many websites that I know is this:
      You have a header area, and any header component that you place there should be inherited by all child pages because typically pages use the same header. Yet, there are a few child pages that do not want to inherit the header, they want to have their own one. There are several reasons for that, sometimes you need additional disclaimers linked, specific language selector links, highlight certain menu items, etc.

      I tried a lot to find an elegant out-of-the-box way to implement this, these are the results (only relevant attributes are given below, and when I say "header" it's just an example of course):

      1. @Area(type=AreaType.LIST) @Inherits(components=ComponentInheritanceMode.ALL)
      --> You can only add another header on a sub-page but not ignore the inherited one. So you end up with several headers on the page.

      2. @Area(type=AreaType.LIST) @Inherits(components=ComponentInheritanceMode.FILTERED)
      --> You can ignore the inherited one, that's very close, but then that non-inheritance is general and effects all children, not just one single page that wants to specifically override the header.

      3. @Area(type=AreaType.SINGLE)
      @Inherits(components=ComponentInheritanceMode.ALL)
      --> Exception on the sub-page with the intended header override: Can't render single area [node ...]: expected one component node but found more.

      And so on (I'm not listing all possible combinations; I'm sure you have an idea).

      What I think is that case 3. should work as needed for that header use case; it's the natural assumption that when you define SINGLE and you place a header on any child page, that implicitely nothing is inherited and it only uses its own newly defined header.

      Thanks.

        Acceptance criteria

              tmattsson Tobias Mattsson
              tln TLN
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD