You are here

exclude_node_title.install in Exclude Node Title 7

Same filename and directory in other branches
  1. 8 exclude_node_title.install
  2. 6 exclude_node_title.install

Exclude Node Title module install/schema hooks.

File

exclude_node_title.install
View source
<?php

/**
 * @file
 * Exclude Node Title module install/schema hooks.
 */

/**
 * Implements hook_install().
 */
function exclude_node_title_install() {

  // Insert in the database the permission to use exclude node title.
  $role_ids = db_query("SELECT rid FROM {role}");
  foreach ($role_ids as $role) {
    db_query("INSERT INTO {role_permission} (rid, permission, module)\n        VALUES (:rid, 'use exclude node title', 'exclude_node_title')", array(
      ':rid' => $role->rid,
    ));
  }
}

/**
 * Implements hook_uninstall().
 */
function exclude_node_title_uninstall() {
  variable_del('exclude_node_title_nid_list');
  variable_del('exclude_node_title_search');
  variable_del('exclude_node_title_hide_using_css');
  variable_del('exclude_node_title_themes_supporting_css');
  foreach (_node_types_build()->names as $key => $val) {
    variable_del('exclude_node_title_content_type_value_' . $key);
    variable_del('exclude_node_title_content_type_modes_' . $key);
  }
}

/**
 * Implements hook_update_N().
 */
function exclude_node_title_update_7100() {
  $exclude_array = array(
    'full' => 'full',
  );
  if (variable_get('exclude_node_title_remove_title', FALSE)) {
    $exclude_array['teaser'] = 'teaser';
  }
  foreach (_node_types_build()->names as $key => $val) {
    switch (variable_get('exclude_node_title_content_type_value_' . $key)) {
      case 'all':
      case 'user':
        variable_set('exclude_node_title_content_type_modes_' . $key, $exclude_array);
    }
  }
  variable_del('exclude_node_title_remove_title');
}