You are here

function rb_views_handler_remove in Rules Bonus Pack 7

Callback for the rb_views_handler_remove action.

Removes a selected handler instance from a view.

File

./rb_views.rules.inc, line 170
Rules plugins related to Views.

Code

function rb_views_handler_remove($view, $handler, $alias) {

  // Find the handler alias in the view representation – these are keyed by
  // numbers, and not by alias.
  $key = array_search($alias, $view->{$handler});
  if ($key !== FALSE) {

    // If the alias is found, remove it and return the updated view repr.
    unset($view->{$handler}[$key]);
    return array(
      'view' => $view,
    );
  }
}