You are here

4 May 2018

Field group lets you do some amazing forms. Still when you have empty element or the form just is too long and needs some custom modifications, you can then use prefix and suffix from form api to append or prepend html.

Source code viewer
  1. /**
  2.  * Implements hook_field_group_pre_render_alter().
  3.  */
  4. function MY_MODULE_field_group_pre_render_alter(&$element, $group, &$form) {
  5. $properties_group_name = 'MY_GROUP_MACHINE_NAME');
  6.  
  7. if ($group->group_name === $properties_group_name) {
  8. $element['#prefix'] = 'PREFIX';
  9. $element['#suffix'] = 'SUFFIX';
  10. }
  11. }
Programming Language: PHP