Drupal.org

#theme should be an array but is documented as a string

Project:Documentation
Component:API documentation files
Category:bug report
Priority:normal
Assigned:Xano
Status:needs work
Issue tags:FAPI reference

Issue Summary

The FAPI docs say form elements' #theme property should be a string, but this property should be an array for *any* renderable element.

Comments

#1

Status:active» needs review

Patch for Drupal 8 that fixes the documentation. Should work for Drupal 7 as well.

AttachmentSize
documentation_1818420_00.patch 2.67 KB

#2

Status:needs review» needs work

The last submitted patch, documentation_1818420_00.patch, failed testing.

#3

The change isn't correct either. It *can* be an array, but only because theme() also accepts an array. But this is a special case that is very seldomly used. Of 190 uses of "'#theme' in core, I've found exactly two that use an array.

so if anything, it should only documented that it is also possible to specify an array, maybe with a reference to the theme() documentation.

#4

Project:Drupal core» Documentation
Version:8.x-dev» <none>
Component:documentation» API documentation files

The FAPI reference is in the Documentation project repo