betasite-1.0.4/betasite.install

betasite.install
<?php

/**
 * @file
 * Install functions for the Beta Site module.
 */

use Drupal\Core\Database\Database;

/**
 * Adds a beta_alias column to the path_alias table.
 */
function betasite_install() {
  // Get the DB schema.
  $schema = Database::getConnection()->schema();

  // Add the beta_alias column.
  if (!$schema->fieldExists('path_alias', 'beta_alias')) {
    $spec = [
      'type' => 'varchar',
      'description' => 'Beta site path alias',
      'length' => 1024,
      'not null' => FALSE,
    ];
    $schema->addField('path_alias', 'beta_alias', $spec);
    $spec = ['fields' => ['beta_alias' => $spec]];
    $schema->addIndex('path_alias', 'path_alias__beta_alias', ['beta_alias'], $spec);
  }
}

/**
 * Removes the beta_alias column from the path_alias table.
 */
function betasite_uninstall() {
  $schema = Database::getConnection()->schema();
  if ($schema->fieldExists('path_alias', 'beta_alias')) {
    $schema->dropIndex('path_alias', 'beta_alias');
    $schema->dropField('path_alias', 'beta_alias');
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc