You are here

function domain_prefix_module_lookup in Domain Access 5

Derive a module name from the table name

In future, SchemaAPI will do this for us. For now, we will have to map core tables.

Parameters

$table: The name of the table being acted upon.

2 calls to domain_prefix_module_lookup()
domain_prefix_form_submit in domain_prefix/domain_prefix.module
FormsAPI for domain_prefix_form.
domain_prefix_get_tables in domain_prefix/domain_prefix.module
Get the tables with the active prefix

File

domain_prefix/domain_prefix.module, line 646
Interface for selective table prefixing for use with Domain Access. For this module to work correctly, you will need to follow the INSTALL.txt instructions for editing your settings.php file.

Code

function domain_prefix_module_lookup($table) {
  $match = explode('_', $table);
  $module = $match[0];
  switch ($table) {
    default:
      break;
    case 'boxes':
      $module = 'blocks';
      break;
    case 'file_revisions':
      $module = 'files';
      break;
    case 'cache_menu':
      $module = 'menu';
      break;
    case 'filter_formats':
      $module = 'filters';
      break;
    case 'access':
    case 'permission':
    case 'role':
    case 'users':
    case 'users_roles':
      $module = 'users';
      break;
    case 'url_alias':
      $module = 'path';
      break;
    case 'variable':
      $module = 'cache';
      break;
    case 'client':
    case 'client_system':
      $module = 'drupal';
      break;
    case 'accesslog':
      $module = 'statistics';
      break;
    case 'term_data':
    case 'term_hierarchy':
    case 'term_node':
    case 'term_relation':
    case 'term_synonym':
      $module = 'taxonomy';
      break;
  }
  return $module;
}