| 1 |
<?PHP
|
| 2 |
|
| 3 |
|
| 4 |
/**
|
| 5 |
* The hook_install implementation
|
| 6 |
*/
|
| 7 |
function invoices_install(){
|
| 8 |
$path = drupal_get_path('module', 'invoices') . '/content_types/';
|
| 9 |
|
| 10 |
invoices_create_content_type($path . 'bank_account.content');
|
| 11 |
invoices_create_content_type($path . 'client.content');
|
| 12 |
invoices_create_content_type($path . 'company.content');
|
| 13 |
invoices_create_content_type($path . 'invoice.content');
|
| 14 |
invoices_create_content_type($path . 'invoice_item.content');
|
| 15 |
|
| 16 |
}
|
| 17 |
|
| 18 |
|
| 19 |
/**
|
| 20 |
* Helper function to import a CCK content type definition from a text file.
|
| 21 |
*
|
| 22 |
* @param $cck_definition_file
|
| 23 |
* The full path to the file containing the CCK definition.
|
| 24 |
*/
|
| 25 |
function invoices_create_content_type($cck_definition_file) {
|
| 26 |
include_once('./'. drupal_get_path('module', 'node') .'/content_types.inc');
|
| 27 |
include_once('./'. drupal_get_path('module', 'content') .'/content_admin.inc');
|
| 28 |
$values = array();
|
| 29 |
$values['type_name'] = '<create>';
|
| 30 |
$values['macro'] = file_get_contents($cck_definition_file);
|
| 31 |
drupal_execute("content_copy_import_form", $values);
|
| 32 |
}
|
| 33 |
|
| 34 |
|
| 35 |
function invoices_uninstall(){
|
| 36 |
db_query("DELETE FROM {system} WHERE name = 'vat'");
|
| 37 |
}
|