📜 ⬆️ ⬇️

Import Content type along with CCK fields


I somehow described the process of importing Views , and now I want to tell how to import the Content type with all CCK fields.

Sometimes it is very necessary when the module is activated to automatically create all types of content with which this module works. To not do this manually, I will tell how it can be done automatically.

I wrote to not forget myself, and to help others :)
I tried to describe everything as much as possible, so it will be understandable even to beginners.
')

First you need to activate the module " Content Copy ", which is part of the CCK
.

Now, if you look at the list of content, a new tab should appear:


Shm it, and choose what content we will import:


Select the required fields:


As a result, get something like this:


Now in the folder with the module you need to create the file module_name.install and write hook_install () into it with the following content:
/**
* Implementation of hook_install()
*/
function module_name_install() {
$content_type_import = "..."; //

$form_state = array();
$form_state['values']['type_name'] = '';
$form_state['values']['macro'] = $content_type_import;

drupal_execute('content_copy_import_form', $form_state);
}


, cck_import, .
features.

Source: https://habr.com/ru/post/111684/


All Articles