Posted By

WimLeers on 10/14/07


Tagged

import textmate drupal cck drupal5


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

WimLeers
basicmagic
kellyharding
riz
rpmute
annalog


Import CCK definition from text file


 / Published in: PHP
 

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

With thanks to joshk :)

  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. }

Report this snippet  

You need to login to post a comment.