1

I am using the field collection module to create my Content. I have 10 text content. For ease of CSS class, I put each content in separate fields and apply the class using the field formatter module, So I have 10 fields and putting 10 text content in each one. Now same thing I can achieve by just making <div></div> 10 times in body of CKEditor (just one field), For example,

<div>Text content 1</div>
<div>Text content 2</div>
<div>Text content 3</div>
.
.
.
<div>Text content 10</div>

Now, in terms of performance will it affect the speed/loading of webpage of drupal 7 sites, if I go by 10 separate field or with one html code with 10 div? I am preferring 10 separate field method, because it is easy to handle editing and updating if needed.

Kind Note: To Moderators, please do not categories this question as opinion based, because i do not have experience with in-terms of performance of website, so I need suggestion/Comparison between this two methods from more experience Drupal developers. Thanks

1

I'd recommend just using one field and changing the "Number of values" in the field settings. This will allow you to add as much as you want and yet only maintain one field.

In case you have different requirements, here's my opinion on the two approaches you are thinking of.

Here are the differences between the two approaches:

10 fields

  • you have many fields that each go through the preprocess, process, field_alter, and any other hook that might affect a field.
  • Assuming they are similar fields any maintenance you would do would have to be done on each on individually.
  • If the fields will eventually have different values then this approach allows you to easily modify them.

1 text area

  • you only have 1 field that does through the whole hook process. Which makes things go faster.
  • You only have 1 field to maintain.
  • It does not make sense to store multiple values in one textarea since it makes curating difficult and prone to typos. Imagine missing a closing div. Boom, layout gone.
  • Also, if in the future you have a case to migrate your content, you will have to make additional effort to migrate these since there are multiple values in the data.

All this said, the two options do not have a HUGE impact on performance if you're just loading them up for display and not doing massive preprocessing.

Your Answer

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

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