function _views_get_tables in Views (for Drupal 7) 5
Constructs the full table information array. Caches it into a global array so that it will only be called once per run.
12 calls to _views_get_tables()
- views_handler_arg_uid_touch in modules/
views_user.inc - views_handler_arg_username in modules/
views_user.inc - views_handler_filter_role_custom in modules/
views_user.inc - views_handler_filter_uid_touched in modules/
views_user.inc - views_ui_admin_import_submit in ./
views_ui.module
File
- ./
views_cache.inc, line 66
Code
function _views_get_tables($full = false) {
static $views_tables;
global $locale;
if (!$views_tables) {
$data = cache_get("views_tables:{$locale}", 'cache_views');
$cache = unserialize($data->data);
if (is_array($cache)) {
$views_tables = $cache;
}
else {
$table_data = module_invoke_all('views_tables');
// allow modules to alter the definitions supplied others
foreach (module_implements('views_tables_alter') as $module) {
$function = $module . '_views_tables_alter';
$function($table_data);
}
$views_tables['tables'] = $table_data;
foreach ($table_data as $name => $table) {
if (is_array($table['filters'])) {
foreach ($table['filters'] as $filter => $data) {
$data['table'] = $name;
// translate for deprecated APIs...
if ($data['option'] && !is_array($data['option'])) {
if ($data['option'] == 'string' || $data['option'] == 'integer') {
$data['option'] = array(
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 255,
);
}
else {
$data['option'] = array(
'#type' => 'select',
'#options' => $data['option'],
);
}
}
if ($data['value'] && !is_array($data['value'])) {
if ($data['value'] == 'string' || $data['value'] == 'integer') {
$data['value'] = array(
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 255,
);
}
else {
$data['value'] = array(
'#type' => 'select',
'#values' => $data['value'],
);
}
}
else {
if ($data['list']) {
$data['value'] = array(
'#type' => 'select',
'#options' => $data['list'],
'#validate' => array(
'views_filter_validate_array' => array(
$data['name'],
),
),
);
if ($data['list-type'] != 'select') {
$data['value']['#multiple'] = TRUE;
}
}
else {
if (!$data['value']) {
$data['value'] = array(
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 255,
);
}
}
}
$views_tables['filters']['titles']["{$name}.{$filter}"] = $data['name'];
$views_tables['filters']['base']["{$name}.{$filter}"] = $data;
}
}
if (is_array($table['fields'])) {
foreach ($table['fields'] as $field => $data) {
if ($data['option'] && !is_array($data['option'])) {
if ($data['option'] == 'string' || $data['option'] == 'integer') {
$data['option'] = array(
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 255,
);
}
else {
$data['option'] = array(
'#type' => 'select',
'#options' => $data['option'],
);
}
}
$data['table'] = $name;
$views_tables['fields']['titles']["{$name}.{$field}"] = $data['name'];
$views_tables['fields']['base']["{$name}.{$field}"] = $data;
}
}
if (is_array($table['sorts'])) {
foreach ($table['sorts'] as $field => $data) {
$data['table'] = $name;
if ($data['option'] && !is_array($data['option'])) {
if ($data['option'] == 'string' || $data['option'] == 'integer') {
$data['option'] = array(
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 255,
);
}
else {
$data['option'] = array(
'#type' => 'select',
'#options' => $data['option'],
);
}
}
$views_tables['sorts']['titles']["{$name}.{$field}"] = $data['name'];
$views_tables['sorts']['base']["{$name}.{$field}"] = $data;
}
}
}
cache_set("views_tables:{$locale}", 'cache_views', serialize($views_tables));
}
}
return $full ? $views_tables : $views_tables['tables'];
}