--- quicktags.module 2008-01-28 15:33:32.000000000 -0600 +++ quicktags_mod.module 2008-01-28 15:33:29.000000000 -0600 @@ -1,5 +1,5 @@ array(0 => t('Everywhere'), 1 => t('Only nodes'), 2 => t('Nodes and comments')), '#description' => t('Where to show the quicktags toolbar.'), ); - + + $types = node_get_types(); + foreach ($types as $type) { + $options[$type->type] = $type->name; + } + + $form['quicktags_options']['quicktags_content_types'] = array( + '#type' => 'checkboxes', + '#title' => t('Content Types'), + '#default_value' => variable_get('quicktags_content_types', array()), + '#options' => $options, + '#description' => t('Content types where to show the quicktags toolbar.'), + ); + return system_settings_form($form); } @@ -88,27 +101,37 @@ function quicktags_elements() { */ function quicktags_show_quicktags() { if (user_access('use quicktags')) { - switch (variable_get('quicktags_show', 0)) { - case 0: - return TRUE; - break; - case 1: - if (arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')) { - return TRUE; - } - break; - case 2: - if (arg(0) == 'node' || arg(0) == 'comment') { + if (arg(1) == 'add') { + $type = node_get_types('type', arg(2)); + } + else if (arg(2) == 'edit') { + $node = node_load(arg(1)); + $type = node_get_types('type', $node); + } + + $allowed_types = variable_get('quicktags_content_types', array()); + + if ($allowed_types[$type->type] === $type->type) { + switch (variable_get('quicktags_show', 0)) { + case 0: return TRUE; - } - break; - default: - return FALSE; + break; + case 1: + if (arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')) { + return TRUE; + } + break; + case 2: + if (arg(0) == 'node' || arg(0) == 'comment') { + return TRUE; + } + break; + default: + return FALSE; + } } } - else { - return FALSE; - } + return FALSE; } /**