You are here

public function draggableviews_hierarchy_handler::get_index in DraggableViews 7.2

Get "results" array index of and item with specific base field id.

Parameters

object $view: Views object

type $id: Base field id.

Return value

int

1 call to draggableviews_hierarchy_handler::get_index()
draggableviews_hierarchy_handler_native::get_depth in handlers/draggableviews_hierarchy_handler_native.inc

File

handlers/draggableviews_hierarchy_handler.inc, line 65
Base plugin implementation.

Class

draggableviews_hierarchy_handler
Parent class for all hierarchy handlers.

Code

public function get_index($view, $id) {
  foreach ($view->result as $key => $item) {
    if ($item->{$view->base_field} == $id) {
      return $key;
    }
  }
}