You are here

public function draggableviews_hierarchy_handler_book::get in DraggableViews 7.2

Get the parent value.

Parameters

object $field: Draggableviews field handler. View is $field->view, to get a row $field->view->result[$index].

int $index: Index of the row.

Return value

int Weight value.

Overrides draggableviews_hierarchy_handler::get

File

draggableviews_book/handlers/draggableviews_hierarchy_handler_book.inc, line 16

Class

draggableviews_hierarchy_handler_book

Code

public function get($field, $index) {
  $row = $field->view->result[$index];
  $parent_mlid = $row->draggableviews_book_plid;
  $parent_link_path = db_query('SELECT link_path FROM {menu_links} WHERE mlid = :mlid', array(
    ':mlid' => $parent_mlid,
  ))
    ->fetchField();
  return !empty($parent_link_path) ? drupal_substr($parent_link_path, 5) : 0;
}