Quantcast
Channel: Open Data - update hooks
Viewing all articles
Browse latest Browse all 2

Delete a content type programmatically in Drupal 7

0
0
Searched words: 
drupal 7 programmatic delete content type

This is what i put as an update hook in a .install file:

<?php
/**
* Delete unused content types.
*
* Adapted from node_type_delete_confirm_submit().
*/
function anjaliup_update_7005() {
 
$types = array(
   
'simplenews',
  );

  foreach(

$types as $type) {
   
node_type_delete('simplenews');
   
variable_del('node_preview_'. $type);
  }

 

node_types_rebuild();
 
menu_rebuild();
}
?>

Not tested yet.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images