I'm working on creating a table with eForm in Drupal 8.

Since label and textfield(input) stick together, can I insert label and textfield(input) into separate <td>?


The Render API, similar in Drupal 7, allows you to add a #theme property to use a hook_theme defined template. The theme definition should use "render element", and that will be available in the template preprocess function. The way that it's usually done is to modify or create the render array in the preprocess function, and set #theme to table (in Drupal 7 calling theme('table') was possible).

Edit: Removed second paragraph which referred to modifying the theme.

  • Sorry, I forgot to mention that I'm only creating a module for this. So, no theme is not available to me. – PHG Nov 2 '15 at 13:46
  • Theme/Templates are defined in modules via hook_theme and the current D8 standard is to place the templates within the module's templates/ directory. – mradcliffe Nov 2 '15 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.