In text.module, text_field_widget_form() tests whether $main_widget has been initialized:

  if ($main_widget) {
    // Conditionally alter the form element's type if text processing is enabled.
    if ($instance['settings']['text_processing']) {
      $element = $main_widget;
      $element['#type'] = 'text_format';
      $element['#format'] = isset($items[$delta]['format']) ? $items[$delta]['format'] : NULL;
      $element['#base_type'] = $main_widget['#type'];
    }
    else {
      $element['value'] = $main_widget;
    }
  }

It seems to me it always is, making the if condition unnecessary.

Comments

dddave’s picture

Assigned: LaurentAjdnik » Unassigned

Re-testing. Feedback?

dddave’s picture

Status: Needs review » Needs work
Issue tags: +Performance

The last submitted patch, text.module.text_field_widget_form.main_widget.patch, failed testing.

Vincent Giersch’s picture

Status: Needs review » Needs work
StatusFileSize
new1.24 KB

Patch was malformed. It was looking for field/modules/text/text.module and not modules/field/modules/text/text.module/

Vincent Giersch’s picture

Status: Needs work » Needs review

Need re-testing.

Issue tags: -Performance

The last submitted patch, text.module.text_field_widget_form.main_widget.patch, failed testing.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.