I'm working in Drupal 8.5.

I have a requirement to create a re-usable widget that the content editors can use to place a set of arbitrary statistics on the home page or elsewhere. So far, this doesn't seem to difficult; I'm planning to use a Paragraph as it will be similar to other Paragraphs we already have in place.

I also have a Taxonomy containing a collection of named locations (think store branches). This is working well; I have a page for each branch showing relevant information.

I now need to add a set of data fields to these locations representing stats about each one, and display them in a panel on the taxonomy page. The important point for my question is that layout for this should be the same as for the generic case above (although the actual stats being shown will be different and would come from the Taxonomy rather than from values entered directly into a Paragraph).

Ideally I would like to use a single template and stylesheet for these two widgets, but I'm unsure how to construct them such that I can share the code.

Can anyone give me some suggestions how to proceed.

Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.