Import CCK definition from text file


/ Published in: PHP
Save to your folder(s)

With thanks to joshk :)


Copy this code and paste it in your HTML
  1. /**
  2.  * Helper function to import a CCK content type definition from a text file.
  3.  *
  4.  * @param $cck_definition_file
  5.  * The full path to the file containing the CCK definition.
  6.  */
  7. function _create_content_type($cck_definition_file) {
  8. include_once('./'. drupal_get_path('module', 'node') .'/content_types.inc');
  9. include_once('./'. drupal_get_path('module', 'content') .'/content_admin.inc');
  10. $values = array();
  11. $values['type_name'] = '<create>';
  12. $values['macro'] = file_get_contents($cck_definition_file);
  13. drupal_execute("content_copy_import_form", $values);
  14. }

URL: http://groups.drupal.org/node/5272

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.