Adding additional buttons to the WYSIWYG
Submitted by skshed on Mon, 02/11/2019 - 11:22
I'm trying to add buttons for "Font size" and Font Color" on the WYSIWYG bar for multichoice and single choice questions. I am using the following code and can add TAGS easily enough but I'm unable to add "FONT" related settings, does anyone please know the correct syntax for this:
function mymods_h5p_semantics_alter(&$semantics, $library_name = NULL) { // Check if this is the multichoice question type. if ($library_name !== 'H5P.MultiChoice') { return; // Nope, do not continue. } foreach ($semantics as $field) { // Go through list fields while ($field->type === 'list') { $field = $field->field; } // Go through group fields if ($field->type === 'group') { mymods_h5p_semantics_alter($field->fields, $library_name); // Check your function name! continue; } // Check to see if we have the correct type and widget if ($field->type === 'text' && isset($field->widget) && $field->widget === 'html') { // Found a field. Add support for table tags. if (!isset($field->tags)) { $field->tags = array(); } $field->tags = array_merge($field->tags, array( 'table', 'thead', 'tfoot', 'tbody', 'tr', 'th', 'td' )); } } }
icc
Fri, 04/12/2019 - 13:06
Permalink
See my answer here.
See my answer here.