'Commit messages', 'page callback' => 'commitlog_operations_page', 'access arguments' => array($view_access), 'type' => MENU_SUGGESTED_ITEM, ); $items['commitlog/repository/%'] = array( 'title' => 'Commit messages', 'page callback' => 'commitlog_operations_page', 'page arguments' => array('repository', 2), 'access arguments' => array($view_access), 'type' => MENU_SUGGESTED_ITEM, ); $items['commitlog/author/%'] = array( 'title' => 'Commit messages', 'page callback' => 'commitlog_operations_page', 'page arguments' => array('author', 2), 'access arguments' => array($view_access), 'type' => MENU_SUGGESTED_ITEM, ); return $items; } /** * Implementation of hook_perm(). */ function commitlog_perm() { return array('access commit messages'); } /** * Implementation of hook_theme(). */ function commitlog_theme() { return array( 'commitlog_operations_page' => array( 'arguments' => array('constraints' => NULL), ), ); } /** * Implementation of hook_views_api(). * * @return array */ function commitlog_views_api() { return array( 'api' => 2, 'path' => drupal_get_path('module', 'commitlog'). '/includes', ); } /** * Page callback for the 'commitlog' family of menu paths. * * @param $type * What type of commit log listing we're creating. Supported types are 'author' and 'repository'. * @param $argument * The argument with which to filter the view. This is used as the first argument in the view in question. */ function commitlog_operations_page($type = NULL, $argument = NULL) { $path = drupal_get_path('module','commitlog'); drupal_add_css($path .'/commitlog.css', 'module'); if ($type == 'author' && !is_null($argument)) { $output = views_embed_view('commitlog_author_commits', 'default', $argument); } else if ($type == 'repository' && !is_null($argument)) { $output = views_embed_view('commitlog_repository_commits', 'default', $argument); } else { $output = views_embed_view('commitlog_global_commits', 'default'); } return $output; }