Join Jon Peck for an in-depth discussion in this video Creating a custom content type manually, part of Drupal 7: Custom Module Development.
Previously, I demonstrated how to add persistent variables to module, then how to remove them …cleanly using hook install and hook uninstall. …When creating and destroying a content type the same hooks are used, which is logical. …Open the IDE and navigate the windfarms. install file and navigate to hook_install following …the message to the user. …I'm going to define the content type itself using an associative array. Start with the …variable definition named content type, Content type definition, content_type = array. The …order of the keys is unimportant, but I'll use a logical progression.…
First, the type of content. This is a machine name. All lower case with spaces instead of underscores. …In this case, I will use windfarm as the name of the content type. …Next, a human readable name for the content type. I will use the T variable for the Translation …function, since hook installed for a module can be called during site installation. …Name is Wind Farm, following the name a brief description.…
- Creating your first module
- Interacting with hooks
- Working with permissions and roles
- Controlling access
- Adding a menu item to an admin interface
- Using the Form API (FAPI) to quickly create a form
- Creating custom form validation
- Manually creating a custom content type
- Validating user input
- Importing content using feeds
- Creating a block
- Understanding best practices and coding standards
Skill Level Advanced
Q: gmap3_tools is not working the way I expected it to. What version of gmap3_tools should I be using?
A: Use the free exercise file containing the version of gmap3_tools used for recording; the published version of the module on drupal.org has changed since recording and is not backwards compatible.
Q: I attempted to run the Drupal site root from the project files, but the site isn't loading. Why not?
A: The Drupal configuration file in sites/default/settings.php contains database configuration specific to the environment used to record the movie. This may be different than your environment. Edit the file and search for "windfarms" - you may need to change the database host, username, password, db name and port to match your specific environment.