1

I have a custom node type (let's call it Project) with many fields. Three of these fields are of an Entity reference type, referencing other related nodes (let's call them Project Attachments A, B, and C).

There are sometimes hundreds of A, B, and C Project Attachments. This puts considerable load on the Project node edit form due to many DB queries being run, sometimes causing timeouts. I have already changed the display of the Project Attachments fields to be read-only and display the associated node ID within the form, which has reduced page load. It displays like this:

Attachment A

  • Test - Copy (node ID)
  • Report Test (node ID)
  • Application_1 (node ID)
  • Other Reference (node ID)
  • Any doc - Copy - Copy (node ID)
  • Any Any (node ID)
  • Fee Breakdown (node ID)
  • .........
  • .........

Is it possible to further change the behaviour of these fields within the form so that there is a button or link that the user can click to only display the associated data when required (ie, not on form load)? Something like:

Attachment A
<button>Click to show data</button>

2
  • Maybe you're better off doing the opposite? Make all attachment nodes reference your project node.
    – No Sssweat
    Commented Jan 5, 2023 at 4:29
  • It should be possible with a custom field widget on an entity reference field type drupal.org/docs/creating-custom-modules/…
    – TheDrot
    Commented Jan 5, 2023 at 12:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.