Removing a content type


show more Removing a content type provides you with in-depth training on Developer. Taught by Jon Peck as part of the Drupal 7 Custom Module Development show less
please wait ...

Removing a content type

Let's continue with the best practice of leaving a clean slate upon uninstall by removing the content type that was created. If I just delete the content type, it doesn't take into account any fields or instances I've added. So those should be removed cleanly as well. Finally, if I remove the content type, the existing nodes will be orphaned and will really mess up functionality. Therefore, it makes sense to delete those nodes as well. I'll start by removing the existing content of type windfarm. To do that I'm going to leverage and Drupal function called node_delete_multiple which deletes a group of nodes based on array of their node IDs.

I'll assemble that list using a database query. One of the features and Drupal 7 is a database abstraction layer which should be leveraged whenever dealing with user input. This layer unifies the interactions with different database servers and provides a structured interface for building queries, providing security,...

Removing a content type
Video duration: 8m 34s 2h 56m Advanced

Viewers:

Removing a content type provides you with in-depth training on Developer. Taught by Jon Peck as part of the Drupal 7 Custom Module Development

Subjects:
Developer Web
Software:
Drupal
Author:
please wait ...