Using Drupal 7, I'm working on a module and want to have it so when the module is installed it will set a new node type called "project" When a user is adding/editing a $note->type="project" I want to bring up a custom editor for my module that is for that node type. I have been looking for tutorials for nodes and editors for nodes but I wasn't able to find any good examples of making a custom node type and making and assigning a custom editor for a node type.

I also don't know what hooks I need to use to target the node editor. As of right now I'm following the steps from the following tutorial. http://www.sitepoint.com/creating-a-new-drupal-node-type/

1 Answer 1


The WYSIWYG module allows embedding any supported WYSIWYG editor to a field via a hook_form_alter()/hook_form_FORM_ID_alter() invocation. Here's a link to its documentation page. You can alter your custom node type form by altering the its body field #type & #format elements.

Note: To do this it also requires:

  1. The WYSIWYG libraries pre-installed to the sites/all/libraries directory.
  2. A pre-existing WYSIWYG profile created.

As such, you'll need to have add a wysiwyg dependency in your module's .info file and some how do the above work in #1/#2 inside your hook_install invocation.

  • I think i may have described the problem in a way that is hard to understand. I don't want to change a single field. I want to override the entire edit page for the node. I want to make a full editor that shows up for this one type. It will look nothing like the normal editor that has each node field listed one after another. I have used the CKeditor in the past to change the widget for a field what i want to do now is have a full custom editor that will replace the node editor all together for the set node and no other node. Commented Aug 17, 2015 at 18:51
  • The hook_form_alter() & hook_form_FORM_ID_alter() functions will let you add/remove customize form elements as you see fit. You can use drupal_add_js & drupal_add_css in there to override the default theming if you're looking to present the form in manner different from its default incarnation.
    – Shawn Conn
    Commented Aug 17, 2015 at 19:05
  • so everything on that page can be altered by the hook_form_alter() & hook_form_FORM_ID_alter() hooks? Commented Aug 17, 2015 at 19:08
  • will this work if i want to for example a toolbar on a side that has draggable elements into a center section. This would then update the node. Commented Aug 17, 2015 at 19:11
  • You can alter all the form elements that will render in the content area of your theme with hook_form_alter(). Other parts of theme surrounding the form will stay the same unless you inject other JS/CSS (via $form['#attached']['js'] & $form['#attached']['css']) to manipulate it. Your own limitation is what you're capable of with JS/CSS.
    – Shawn Conn
    Commented Aug 17, 2015 at 22:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.