You are here

hashtags.install in Hashtags 6

File

hashtags.install
View source
<?php

// $Id$

/**
* Implementation of hook_enable().
*/
function hashtags_enable() {
  if (!variable_get('hashtags_vocabulary', 0)) {

    // Create hashtags taxonomy
    $vocabulary = array(
      'name' => t('Hashtags'),
      'multiple' => 1,
      'tags' => 1,
      'required' => 0,
      'hierarchy' => 1,
      'relations' => 0,
      'module' => 'hashtags',
      'weight' => -10,
    );
    taxonomy_save_vocabulary($vocabulary);
    variable_set('hashtags_vocabulary', $vocabulary['vid']);

    // add Hashtags filter to system input formats
    hashtags_add_filter();
    drupal_set_message('Hashtags module: go to ' . l(t('hashtags vocabulary'), 'admin/content/taxonomy/edit/vocabulary/' . $vocabulary['vid']) . ', check content types that you want Hashtags to work and submit a form');
  }
}

/**
* Implementation of hook_uninstall().
*/
function hashtags_uninstall() {

  // Load the dependent Taxonomy module, in case it has been disabled.
  drupal_load('module', 'taxonomy');

  // Delete the vocabulary.
  $vid = variable_get('hashtags_vocabulary', '');
  taxonomy_del_vocabulary($vid);
  variable_del('hashtags_vocabulary');

  // remove Hashtags filter out of all input formats
  $module = 'hashtags';
  db_query("DELETE FROM {filters} WHERE module = '%s'", $module);
  drupal_set_message(t('Hashtags module: Hashtags filter has been removed from all input format'));
}

/**
 * Implementation of hook_update_600N().
 */
function hashtags_update_6001() {
  $ret = array();

  // add Hashtags filter to system input formats
  hashtags_add_filter();
  $ret[] = array(
    'success' => TRUE,
    'query' => 'Hashtags filter has been added to system input formats.',
  );
  return $ret;
}

Functions

Namesort descending Description
hashtags_enable Implementation of hook_enable().
hashtags_uninstall Implementation of hook_uninstall().
hashtags_update_6001 Implementation of hook_update_600N().