1

I want to user a different default tinymce editor styles per content type. I basically want to use a different default font in the editor area of tinymce per content type.

I have discovered that the editor of tinymce has some default settings that are not configurable through the WYSIWYG module, but it can by modifying the file jscripts/tiny_mce/themes/advanced/skins/default/content.css

However, that would apply to all content types.

Is there a way to set a skin for a content type?

This would be a start, but does not apply it per content type:

/**
 * Implements hook_wysiwyg_editor_settings_alter().
 */
function custom_wysiwyg_editor_settings_alter(&$settings, $context) {
  if ($context['profile']->editor == 'tinymce') { 
  $settings['skin'] = 'o2k7';
  $settings['skin_variant'] = 'silver';
  }
}
  • 1
    I assume you've looked through the $context and $settings variables for something related to content type? – Darvanen Apr 7 '15 at 1:00
0

I think you're on the right track, but from memory, I don't think you'll have info about the content type or the node form in the $settings and $context variables, As Darvanen suggests.

I'd implement hook_form_alter() to match node forms, then read the content type being used, and store it as a static variable through drupal_static() function. That way you can access the content type info from the snippet you pasted above, using that same drupal_static() function, and then choose which skin to use.

  • Sounds good, but my coding skills are a bit too limited for your solution, sorry :-( – Yuri Apr 22 '15 at 21:55

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.