Score:0

Is there a way to duplicate existing fields instead of manually creating new ones?

us flag
jfc

I am using Drupal 9 and I have a template which will require 40 text fields and 20 image fields.

They are meant to display 20 individual products, so they are all similar. The display would be something like this -

Product Title 1 Product Thumbnail 1 Product Subtitle 1

Product Title 2 Product Thumbnail 2 Product Subtitle 2

And so on for 20 products.

To add this field manually will take a very long time since it's 60 fields. Is there a module or some other way to duplicate existing fields?

ru flag
Sorry, but this is a terrible idea. Either use an Entity Refeference field and link 20 product content entities or use the [Paragraphs module](https://www.drupal.org/project/paragraphs) and create a repeatable Paragraph with your 3 fields.
Score:3
cn flag

If you have 20 products, you have 20 things. In Drupal-speak, you have 20 entities.

In Drupal, every "thing" is an entity-- pages (nodes) are entities, and comments are also entities.

Each "thing" should be its own entity type. Drupal provides a lot of tools for linking different entities (such as Entity Reference module) and displaying entities (such as Layout Builder module and Views module). But, all of these tools assume that each "entity" is representing a single thing.

So, if you put 20 products in one entity (node/page), you will prevent yourself from using most of Drupal's features that make it a great CMS.

Instead, I suggest making a custom content type, Product. You can add just three fields to the product:

  • Title
  • Thumbnail
  • Subtitle

Next, create 20 products by adding content of your new content type Product.

Then, create a view using the Views module. This will give you great control over how the products are displayed-- you can make a simple list of products to start, and if you want to expand it later, you can show related products and do many other cool things.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.