Commit 89971a9f authored by merlinofchaos's avatar merlinofchaos
Browse files

More yched cleanup

parent 88bde8e4
......@@ -180,27 +180,37 @@ function views_invalidate_cache() {
* the $view object than is in the database, and this isn't necessarily
* set when a view is constructed externally.
*/
function _views_sanitize_view(&$view) {
function views_sanitize_view(&$view) {
_views_check_arrays($view); // so reference works.
foreach ($view->field as $i => $field) {
$view->field[$i]['id'] = $view->field[$i]['fullname'] = "$field[tablename].$field[field]";
$view->field[$i]['queryname'] = "$field[tablename]_$field[field]";
if (!isset($view->field[$i]['id'])) {
$view->field[$i]['id'] = $view->field[$i]['fullname'] = "$field[tablename].$field[field]";
$view->field[$i]['queryname'] = "$field[tablename]_$field[field]";
}
}
foreach ($view->filter as $i => $filter) {
$view->filter[$i]['id'] = $view->filter[$i]['field'] = "$filter[tablename].$filter[field]";
if (!isset($view->filter[$i]['id'])) {
$view->filter[$i]['id'] = $view->filter[$i]['field'] = "$filter[tablename].$filter[field]";
}
}
foreach ($view->exposed_filter as $i => $exposed_filter) {
$view->exposed_filter[$i]['id'] = $view->exposed_filter[$i]['field'] = "$exposed_filter[tablename].$exposed_filter[field]";
if (!isset($view->exposed_filter[$i]['id'])) {
$view->exposed_filter[$i]['id'] = $view->exposed_filter[$i]['field'] = "$exposed_filter[tablename].$exposed_filter[field]";
}
}
foreach ($view->sort as $i => $sort) {
$view->sort[$i]['id'] = $view->sort[$i]['field'] = "$sort[tablename].$sort[field]";
if (!isset($view->sort[$i]['id'])) {
$view->sort[$i]['id'] = $view->sort[$i]['field'] = "$sort[tablename].$sort[field]";
}
}
foreach ($view->argument as $i => $argument) {
$view->argument[$i]['id'] = $view->argument[$i]['type'];
if (!isset($view->argument[$i]['id'])) {
$view->argument[$i]['id'] = $view->argument[$i]['type'];
}
}
}
......@@ -226,7 +236,7 @@ function _views_get_default_views() {
$views_default_views = array();
foreach ($views as $i => $view) {
if (!is_array($view->requires) || !array_diff($view->requires, $tables)) {
_views_sanitize_view($view);
views_sanitize_view($view);
$views_default_views[$i] = $view;
}
}
......
......@@ -351,7 +351,7 @@ function views_import_view_submit($formid, $form) {
$tables = array_keys(_views_get_tables());
if ($view) {
if (!is_array($view->requires) || !array_diff($view->requires, $tables)) {
_views_sanitize_view($view);
views_sanitize_view($view);
drupal_set_title(t('Add a View'));
$output = _views_view_form($view, NULL);
print theme('page', $output);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment