Advertisement
Guest User

Untitled

a guest
Mar 1st, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. function mymods_h5p_semantics_alter(&$semantics, $library_name = NULL) {
  2. // Check if this is the multichoice question type.
  3. if ($library_name !== 'H5P.PersonalityQuiz') {
  4. return; // Nope, do not continue.
  5. }
  6.  
  7. foreach ($semantics as $field) {
  8. // Go through list fields
  9. while ($field->type === 'list') {
  10. $field = $field->field;
  11. }
  12.  
  13. // Go through group fields
  14. if ($field->type === 'group') {
  15. mymods_h5p_semantics_alter($field->fields, $library_name); // Check your function name!
  16. continue;
  17. }
  18.  
  19. // Check to see if we have the correct type and widget
  20. if ($field->type === 'text' && isset($field->widget) && $field->widget === 'html') {
  21. // Found a field. Add support for table tags.
  22. if (!isset($field->tags)) {
  23. $field->tags = array();
  24. }
  25. $field->tags = array_merge($field->tags, array(
  26. 'table',
  27. 'thead',
  28. 'tfoot',
  29. 'tbody',
  30. 'tr',
  31. 'th',
  32. 'td'
  33. ));
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement