tablefield_form_alter() runs for every form on every page. It invokes field_info_instance() for every form and field_info_field() for every table field for every form, even when the form doesn't contain the table field.

Using information saved in $form_state['field'] by the field system it is possible to prevent database calls caused by tablefield_form_alter() on pages that have no table field.

Comments

Jorrit created an issue. See original summary.

Jorrit’s picture

Status: Active » Needs review
StatusFileSize
new1.8 KB

Please see the attached patch.

Jorrit’s picture

Fixed a notice.

  • lolandese committed 51b131b on 7.x-3.x authored by Jorrit
    Issue #2992511 by Jorrit: Optimize tablefield_form_alter
    
lolandese’s picture

Status: Needs review » Fixed

Patch:

  • applies cleanly
  • does as advertised.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.