As my current project is wrapping up… my clients have last minute change requests. In this project the site is moving from Drupal 6 to Drupal 7. In the past the website had a Drupal Book content type that had a Graduate Program Handbook for prospective students entering a college’s graduate program. In moving to Drupal 7 the client had many change requests. During the final last minute changes of the website I was able to install and play with the Node Convert module.
During the final approval and release of this project the client had the following last minute requests:
- Remove the Drupal 6 Graduate Handbook
- Replace the 28 page handbook with a simple PDF file uploaded to the server.
- Bring back the on-site handbook but update it to the new PDF file contents and make sections of the handbook a single drupal node per section. The old site had multiple subsections per major section. For example:
- Section 1: Applicants
- Section 1.1: Prerequisites
- Section 1.2: Forms
- Section 1.3: Methods of Submission
- Section 1.3.1: Digital uploads
- Section 1.3.2: FAX
- Section 1.3.3: Mail
- Section 1: Applicants
- For book pages show a menu of the book index when viewing any book node in the Right Sidebar of the theme.
These requests came at a final wrap-up meeting for the project with the website visible on a QA (quality assurance) demo server, and accessible only to the client by password. This project was initially built using Drush as a migration tool I dont really want to script these changes to Content on the website.
Using Node Convert
I’ve used the Book module in the past a number of time; but I feel I’ve not discovered the full potential the module. Since the client wanted a single Section per node of the Handbook the idea is to configure Drupal to:
- Store a handook page as a Node.
- somehow apply the book index to every book page.
- support sub section linking (Anchor links) in the book outline index.
Of all these requirements item (3) is not easily supported by the book module out of the box. So ideally a custom Menu will hold the book items and by using Special Menu Items we can support Anchors within handbook sections without needing to create a Node per subsection.
So I debated using simple Pages in Drupal and a custom Menu for these pages to create our much simpler book-like Drupal feature. Our new “book” would only be 18 pages in length …. if only I could easily migrate existing book nodes to page node content type.
The Node Convert module allows us to easily do this on a live site. A programmatic alternative to this approach could be to use our trusty Migrate module — but I’m “done” with the project and just want to bang this out!
To change existing book content into page content we follow these simple steps:
- Install the module, as any other contributed module.
- Then within the Node Convert admin UI you must create a template for the data you will be moving (meaning map the fields between 2 content types). These templates are applied between 2 existing content types.
- The Admin UI provides a listing of templates between convertable content types that you’ve previously assigned. Since I’m working with basic Book and Page content types in Drupal I created a set of templates that let me test moving content from a Page to a Book, or from a Book to a Page:
- After you have your conversion templates setup you can goto the Admin -> Content screen, select the content you want to convert and select your new conversion action you’ve created. The Batch API then converts your data:
As you can see this is very direct approach to migrating some existing Drupal content around to other content types! It may not be the most flexible solution, but can meet many needs out the box.
Looking for quality web hosting? Look no further than Arvixe Web Hosting!