- Створити новий тип node(напр. “my_wiki_page”).
 Або через інтерфейс Друпал, або через модуль. Тут і надалі буде описуватися створення через написання власного модуляmy_wiki.
/**
* Implementation of hook_node_info()
*/
function my_wiki_node_info() {
  return array(
      'my_wiki_page' => array(
        'name' => t('My wiki page'),
        'module' => 'my_wiki',
        'description' => 'My Drupal wiki pages',
        ),
  );
}
/**
 * Implementation of hook_perm()
 */
function my_wiki_perm() {
  return array(
      'create wiki page',
      'edit any wiki page',
      'edit own wiki page',
      'delete any wiki page',
      );
}
/**
 * Implementation of hook_access()
 */
function my_wiki_access($op, $node, $account) {
  // NOTE: For creation operations the $node is a string, not an object
  if ($op == 'create' && $node) {
    // Only users with permission to do so may create this node type.
    if ($node === 'my_wiki_page') {
      return user_access('create wiki page', $account);
    }
  }
  if ($node->type == 'my_wiki_page') {
    // Operations with wiki pages
    // Only users with permission to do so may edit/delete this node type.
    // Users who create a node may edit or delete it later, assuming they have the
    // necessary permissions.
    if ($op == 'update') {
      if (user_access('edit any wiki page', $account)) {
        return TRUE;
      }
      if (user_access('edit own wiki page', $account) && ($account->uid == $node->uid)) {
        return TRUE;
      }
    }
    if ($op == 'delete') {
      if (user_access('delete any wiki page', $account)) {
        return TRUE;
      }
      if (user_access('edit own wiki page', $account) && ($account->uid == $node->uid)) {
        return TRUE;
      }
    }
  }
}
- Встановити модулі Wikitools, Diff  та Pathauto. Можна й не встановлювати, якщо правильно вказати залежності модуля, цей модуль встановиться автоматично разом з новим модулем. Досить лише помістити скачаний модуль до директорії "sites/all/modules".
 
- Встановити правильні дозволи.. Всі користувачі повинні мати наступні дозволи:
 "access content",
 "create wiki page",
 "edit own wiki page",
 "view revisions",
 "revert revisions".
 Привілейовані користувачі також можуть додатково мати наступні дозволи:
 "edit any wiki page",
 "delete any wiki page".
 
 
- Налаштувати шаблони Pathauto. Можна функцією:
 /* * Function which creates the "Pathauto" patterns for URLs of content related to wiki pages. */ function _my_wiki_create_pathauto_patterns() { $node_type = 'my_wiki_page'; variable_set('pathauto_node_' . $node_type . '_pattern', 'wiki/[title-raw]'); }
 
- Встановити "My wiki page" як тип сторінки для модуля Wikitools.
 Функція встановлення налаштувань модуля Wikitools:
 /* * Function which enables needed settings of the Wikitools module. */ function _my_wiki_wikitools_enable_settings() { // Load the "filter_admin_format_form" function and its "_submit". module_load_include('inc', 'wikitools', 'wikitools.admin'); // Array of pages that should be used as wiki pages $wiki_pages = array( 'my_wiki_page' => 1, ); $wikitools_fields = array(); $wikitools_fields['values']['wikitools_node_types'] = $wiki_pages; $wikitools_form = wikitools_admin_settings($wikitools_fields); system_settings_form_submit($wikitools_form, $wikitools_fields); // Print messages drupal_set_message(); }
- Виклик останніх функцій слід помістити в hook_enableмодуля:
 /** * Implementation of hook_enable() */ function my_wiki_enable() { // Create needed Pathauto patterns of aliases _my_wiki_create_pathauto_patterns(); // Enable needed settings of the Wikitools module. _my_wiki_wikitools_enable_settings(); }
- Встановити правильні поля форми створення сторінки, використавши hook_formхук:
 /** * Implementation of hook_form() */ function my_wiki_form(&$node, $form_state) { if (!empty($node)) { if ($node->type == 'my_wiki_page') { // Create modified form for create/edit wiki node. // Set proper title for wiki page creation if (arg(1) === 'add') { drupal_set_title(t('Create Wiki Page')); } $type = node_get_types('type', $node); // Set node parameters $node->promote = FALSE; $node->revision = 1; $node->comment = 0; // Set title $form['title'] = array( '#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5 ); // Set body $form['body_filter']['body'] = array( '#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => $node->body, '#required' => FALSE ); // Set format $form['body_filter']['filter'] = filter_form($node->format); // Set revisions $form['revision_information']['revision']['#default_value'] = $node->revision; // Disable comments if (isset($form['comment_settings']['comment'])) { $form['comment_settings']['comment']['#default_value'] = $node->comment; } // Node options for administrators $form['options'] = array( '#type' => 'fieldset', '#access' => user_access('administer nodes'), '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 25, ); $form['options']['promote'] = array( '#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote, ); return $form; } } }
 
- Встановити CKEditor як редактор для сторінок або використовувати якийсь із вікі-фільтрів, наприклад: flexifilter або pearwiki filter.
Тепер (після встановлення цього модуля) за шляхом
"/wiki" Вашого сайту Вам буде запропоновано створити головну сторінку ("Main Page"). Так само, якщо ввести шлях типу "http://<Ваш сайт>/wiki/test", Вам буде запропоновано створити дану сторінку. Модуль Diff надасть можливість порівнювати зміни між ревізіями файла.Дивіться також: http://cwgordon.com/how-to-create-a-wiki-with-drupal.
PS. Вміст .info файла для модуля:
; $Id$ name = "My wiki" description = "Module which provides wiki pages" package = "My modules" version = 1.0 core = 6.x dependencies[] = diff dependencies[] = pathauto dependencies[] = wikitools
