array( 'template' => 'calendario-embed-widget', 'variables' => array('link' => NULL), ), ); } /** * Implements hook_entity_info_alter() * * @todo * Change 'uri callback' from taxonomy terms to point to calendars. */ function calendario_entity_info_alter(&$entity_info) { // Set the controller class for nodes to an alternate implementation of the // DrupalEntityController interface. /* *$entity_info['node']['controller class'] = 'MyCustomNodeController'; */ /* Your code here */ } /** * Include a calendar widget. */ function calendario_widget($view = NULL) { $display = $view->current_display; $path = explode('/', $view->display[$display]->handler->options['path']); switch ($path[1]) { case 'dia': case 'semana': case 'mes': case 'ano': $type = NULL; $period = $path[1]; //$date = isset($path[2]) ? .'/'. $path[2] : ''; $date = isset($view->args[0]) ? '/'. $view->args[0] : ''; $argument = NULL; //$link = $period . $date; $link = $period; break; default: $type = $path[1]; $period = $path[3]; //$date = isset($path[4]) ? .'/'. $path[4] : ''; $date = isset($view->args[1]) ? '/'. $view->args[1] : ''; //$argument = $path[2]; $argument = isset($view->args[0]) ? '/'. $view->args[0] : ''; //$link = $type . $argument .'/'. $period . $date; $link = $type . $argument .'/'. $period; break; } return theme('embed-widget', array('link' => $link)); } /** * Implements hook_views_post_render() */ function calendario_views_post_render(&$view, &$output, &$cache) { if (substr($view->name, 0, 10) == 'calendario' && substr($view->name, 0, 17) != 'calendario_widget') { $output .= calendario_widget($view); } }