0

I'd like to create a one-off custom page which will contain several text fields.

The layout for the page will be custom, placing the text fields in various locations next to design elements, diagrams and maps. I'd like the site editors to be able to update the text fields/labels, including language versions.

I'm generally familiar with the render API, page and node templates, and I do know that I could create a dedicated content type (node, content entity) with all the fields required and then a page template (Drupal 8 custom page template) to render the node (and its language versions).

Just wondering if it makes sense to create a complete content type for what will effectively be a one-off (albeit important) node/page.

Thoughts? Suggestions?

closed as too broad by Mołot, Pierre.Vriens, Adrian Cid Almaguer, Krishna Mohan, Shawn Conn Feb 10 '16 at 17:32

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I think it would be easiest to create an one off content type as long as you're not stuffing the content type with 100s of fields. – mradcliffe Feb 9 '16 at 22:35
  • I have no idea why this was closed. In any case, custom block types can now be defined in Drupal 8. They are fieldable as well, which means I can create a 'Page Labels', or 'Page ToolTips' custom block type, with a plain text field that has unlimited cardinality. I'll then create a custom block, based on this new 'Block Type' and place this on the matching map page. I can control the individual placement of labels/tips via a Twig page template and CSS. – Blue Waters Feb 16 '16 at 8:43
1

You might want to have a look at the Paragraphs project. It basically allows you to create different building blocks (Image with text, Diagram with description, ...) and then you can piece them together in the edit form pretty easily.

Check out the demo module that's part of the project for a quick start. You'll still have to actually implement the design for each building block but once you have that, you can easily change how you've combined them and move parts around, add new ones.. create multiple pages that each uses those building blocks differently.

  • Thanks @Berdir - Paragraphs would definitely do the job. I've also just 'tweaked' that function hook_form_alter, and I believe hook_page_alter could also be used to add the additional fields, and control how they are laid out on a custom (node specific) page template. – Blue Waters Feb 10 '16 at 2:58

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