You are here

function _views_check_sub_ops in Views (for Drupal 7) 5

Figure out which of the many, many buttons on a form were clicked and handle it.

1 call to _views_check_sub_ops()
views_ui_add_section in ./views_ui.module
Add one of the list sections to the form.

File

./views_ui.module, line 673

Code

function _views_check_sub_ops(&$form, &$order, $i) {
  if ($form['delete']['#value']) {
    unset($form['delete']['#value']);
    unset($order[$i]);
    $order = array_values($order);

    // reindex
    $form['delete']['#printed'] = true;
    $form['up']['#printed'] = true;
    $form['down']['#printed'] = true;
    $form['top']['#printed'] = true;
    $form['bottom']['#printed'] = true;
    return 'delete';
  }
  else {
    foreach (array(
      'up',
      'down',
      'top',
      'bottom',
    ) as $dir) {
      if ($form[$dir]['#value']) {
        unset($form[$dir]['#value']);
        $func = "_views_move_{$dir}";
        $func($order, $i);
        return true;
      }
    }
  }
  return false;
}