You are here

Drupal 7 - An Annoying Error

Error message

  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; views_display has a deprecated constructor in require_once() (line 3047 of /homepages/3/d267786686/htdocs/pangus/includes/bootstrap.inc).
  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; views_many_to_one_helper has a deprecated constructor in require_once() (line 113 of /homepages/3/d267786686/htdocs/pangus/sites/all/modules/contrib/ctools/ctools.module).

One error I encountered early on in D7 development was an annoying one I would get when uninstalling a custom content-type:


	Notice: Trying to get property of non-object in comment_node_type_delete()

I spent a number of hours trying to find the solution on the Drupal forums and elsewhere until I finally came across a post on Dollar Dad which had the answer. For modules with custom content-types you need to have 'base' set to 'node_content'.


// Define the node type.
$node_example = array(
	'type' => 'node_example',
	'base' => 'node_content',
	'name' => $t('Example Node'),
	'description' => $t('This is an example node type with a few fields.'),
	'body_label' => $t('Example Description'),
	'promote' => 0,
);

Another solution has been found

I have written a new post called Drupal 7 - An Annoying Error: Part the Second which discusses how to correct this error should using 'node_content' as your base type be an un-acceptable solution.

Tags: