Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3969172
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:55:55+00:00 2026-05-20T03:55:55+00:00

I created a hook in order to add an item to the administrator’s menu.

  • 0

I created a hook in order to add an item to the administrator’s menu. When the user clicks on the item, I want to return the content of a specific view I created. How should I return the view?

My current code looks like:

function my_view_menu(){
   $items['view'] = array(
    'title' => 'Report', 
    'page callback' => 'return_my_view', 
    'access arguments' => array('access content'), 
    'type' => MENU_NORMAL_ITEM,
  );    
   return $items;
}

function return_my_view(){
  return t("Hello!");
} 

EDIT:

As suggested by Berdir, this the correct way to call a view:

function return_my_view(){
  $viewName = 'my_report'; // use the machine readable name of the view
  return views_embed_view($viewName);
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:55:56+00:00Added an answer on May 20, 2026 at 3:55 am

    You want views_embed_view(), see http://web.archive.org/web/20110213234806/http://thedrupalblog.com/embedding-view-drupal-6-using-views-embed-view

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to upgrade user's permission after the order status shows
I'm trying to add a function I created to a hook, but the obvious
I want to create a keyboard and mouse hook which will be started as
I created a program using dev-cpp and wxwidgets which solves a puzzle. The user
I created an Interop user control in VS2005. When the user control is shown
I created a module with an observer for the sales module with event hook
I have created a web user control called Activity. I have defined a public-facing
In order to use SetWindowsHookEx in a GUI application, you usually want in the
I have created a subversion post-commit hook to send out an email everytime a
I have a type: public class IssueForm { Order Order {get; set;} Item Item

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.