You are here

function page_manager_get_operation in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 page_manager/page_manager.admin.inc \page_manager_get_operation()

Get an operation from a trail.

Return value

array($operation, $active, $args)

1 call to page_manager_get_operation()
page_manager_get_operation_content in page_manager/page_manager.admin.inc
Fetch the content for an operation.

File

page_manager/page_manager.admin.inc, line 764
Administrative functions for the page manager.

Code

function page_manager_get_operation($operations, $trail) {
  $args = $trail;
  $stop = FALSE;
  $active = array();
  $titles = array();

  // Drill down into operations array:
  while (!$stop) {
    $check = reset($args);
    $stop = TRUE;
    if (is_array($operations)) {
      if (isset($operations[$check])) {
        $active[] = $check;
        $operation = array_shift($args);

        // check to see if this operation has children. If so, we continue.
        if (!isset($operations[$check]['children'])) {
          $operations = $operations[$check];
        }
        else {
          $titles[] = $operations[$check]['title'];
          $operations = $operations[$check]['children'];

          // continue only if the operation hs children.
          $stop = FALSE;
        }
      }
    }
  }
  return array(
    $operations,
    $active,
    $args,
    $titles,
  );
}