function _views_check_ops in Views (for Drupal 7) 5
Figure out if one of the add buttons on a form were clicked, and handle it.
1 call to _views_check_ops()
- views_edit_view in ./
views_ui.module - Display all the guts of a view in a form for editing.
File
- ./
views_ui.module, line 700
Code
function _views_check_ops(&$view, $op, $form) {
if ($op == t('Add Filter')) {
$view->new_filter['id'] = $form['filter']['add']['id']['#value'];
return 'filter';
}
else {
if ($op == t('Add Criteria')) {
$view->new_sort['id'] = $form['sort']['add']['id']['#value'];
return 'sort';
}
else {
if ($op == t('Add Argument')) {
$view->new_argument['id'] = $form['argument']['add']['id']['#value'];
return 'argument';
}
else {
if ($op == t('Add Field')) {
$fieldbits = explode('.', $form['field']['add']['id']['#value']);
$view->new_field['id'] = $form['field']['add']['id']['#value'];
$view->new_field['tablename'] = $fieldbits[0];
$view->new_field['field'] = $fieldbits[1];
$view->new_field['queryname'] = "{$fieldbits[0]}_{$fieldbits[1]}";
return 'field';
}
else {
if ($op == t('Expose Filter')) {
$view->new_exposed_filter['id'] = $form['exposed_filter']['add']['id']['#value'];
return 'filter';
}
}
}
}
}
}