API page: https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...

Enter a descriptive title (above) relating to Form API Reference, then describe the problem you have found:

The API documentation shows that managed_file supports #prefix and #suffix, and does not support #field_prefix and #field_suffix.

In fact, the opposite is true. The managed_file field supports #field_prefix and #field_suffix, NOT #prefix and #suffix.

Comments

abtbrians created an issue. See original summary.

David_Rothstein’s picture

Title: Form API Documentation Is Incorrect » Managed field element is documented as supporting #prefix and #suffix but only supports #field_prefix and #field_suffix instead
Component: documentation » file.module
Priority: Major » Normal

Hm, that is odd - I thought everything supported #prefix and #suffix. But trying it out with this it seems like you're right:

  $form['test'] = array(
    '#type' => 'managed_file',
    '#title' => t('Test'),
    '#upload_location' => 'public://',
    '#default_value' => 0,
    '#prefix' => 'test prefix',
    '#suffix' => 'test suffix',
    '#field_prefix' => 'test field prefix',
    '#field_suffix' => 'test field suffix',
  );

The form API documentation is not stored within Drupal core - this issue would need to be moved to https://www.drupal.org/project/issues/documentation?component=API+docume... instead to patch it there.

However I didn't do that myself because I wonder if this might be a bug in the actual functionality instead...

David_Rothstein’s picture

Title: Managed field element is documented as supporting #prefix and #suffix but only supports #field_prefix and #field_suffix instead » "managed_file" element is documented as supporting #prefix and #suffix but only supports #field_prefix and #field_suffix instead