EclipseGc

Untitled

Feb 28th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. protected function convertDrupalItem($router_item) {
  2.     $route = array(
  3.       '_controller' => $router_item['page_callback']
  4.     );
  5.     // Place argument defaults on the route.
  6.     foreach ($router_item['page_arguments'] as $k => $v) {
  7.       $route['node'] = $v;
  8.     }
  9.     $path = explode('/', $router_item['path']);
  10.     $i = 0;
  11.     foreach ($path as $element_key => $element) {
  12.       if ($element == '%') {
  13.         $path[$element_key] = "{element$i}";
  14.       }
  15.       $i++;
  16.     }
  17.     return new Route(implode('/', $path), $route);
  18.   }
Advertisement
Add Comment
Please, Sign In to add comment