Perroin Thibault
Perroin Thibault

Reputation: 553

How to call a node in a hook menu?

I hope you can help me because I don't know how to call a node in a hook_menu in Drupal 7.

Is it possible ?

$items['basketfacile/planning'] = array(
        'type' => MENU_LOCAL_TASK,
        'title' => 'Test',
        'description' => "description",
        'page callback' => 'drupal_get_form',
        'page arguments' => array('basketfacile_plannings_form'),
        'access arguments' => array('access content')
    );

This is my item menu who call a form, but I want to call a node form which allready exists in my Drupal installation. We can take Article for example.

Have you an idea ?

Upvotes: 2

Views: 1553

Answers (1)

Perroin Thibault
Perroin Thibault

Reputation: 553

In fact, it's very easy to embed a node in an other page you can do that :

$items['menu/submenu'] = array(
        'type' => MENU_LOCAL_TASK,
        'title' => 'YOUR_TITLE',
        'description' => "YOUR_DESCRIPTION",
         'page callback' => 'node_add',
        'page arguments' => array('YOUR_NODE_TYPE_NAME_MACHINE'),
        'access callback' => 'node_access',
        'access arguments' => array('create', 'YOUR_NODE_TYPE_NAME_MACHINE'),
        'file' => 'node.pages.inc',
        'file path' => drupal_get_path('module', 'node')
);

Upvotes: 3

Related Questions