function migrate_views_default_views_alter in Migrate 6
Implementation of hook_views_default_views_alter().
File
- ./
migrate.views_default.inc, line 21 - Modify the default views of message tables
Code
function migrate_views_default_views_alter(&$views) {
// Only do this if Table Wizard is active
if (!module_exists('tw')) {
return;
}
// Go through each content set and alter the Table Wizard's default view for its message
// table to add an argument (level), and alter the access permission
$sql = "SELECT mcsid, view_name, sourcekey FROM {migrate_content_sets}";
$tblresult = db_query($sql);
while ($tblrow = db_fetch_object($tblresult)) {
$viewname = migrate_message_table_name($tblrow->mcsid);
// Make sure the table exists and is known to Table Wizard - otherwise we'll break stuff
// all over the place (#560380)
if (!db_table_exists($viewname)) {
continue;
}
else {
$sql = "SELECT twtid FROM {tw_tables} WHERE tablename='%s' AND dbconnection='default'";
$twtid = db_result(db_query($sql, $viewname));
if (!$twtid) {
continue;
}
}
if (function_exists('tw_get_view_name')) {
$viewname = tw_get_view_name($twtid);
}
$view = $views[$viewname];
$view->display['default']->display_options['arguments'] = array(
'level' => array(
'id' => 'level',
'field' => 'level',
'table' => $viewname,
'relationship' => 'none',
'default_action' => 'ignore',
),
);
$view->display['default']->display_options['access'] = array(
'type' => 'perm',
'perm' => MIGRATE_ACCESS_BASIC,
);
// Not interested in displaying these
unset($view->display['default']->display_options['fields']['mceid']);
unset($view->display['default']->display_options['fields']['level']);
$view->display['default']->display_options['title'] = t('Migration messages for content set !view', array(
'!view' => $viewname,
));
$view->display['default']->display_options['header'] = t('Listing of messages reported when importing this content set.');
$views[$viewname] = $view;
}
}