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 788585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:23:24+00:00 2026-05-14T21:23:24+00:00

I have not been able to get drupal_get_form to pass on the node data.

  • 0

I have not been able to get drupal_get_form to pass on the node data. Code snippets are below. The drupal_get_form documentation (api.drupal.org) states that it will pass on the extra parameters. I am basing the node data not being passed because (apparently) $node[‘language’] is not defined in hook_form which causes $form[‘qqq’] not to be created and thus the preview button shows up.

My goal here is that the preview button show up using path “node/add/author” but doesn’t show up for “milan/author/add”. Any alternative methods for achieving this goal would be helpful but the question I want answered is in the preceding paragraph. Everything I’ve read indicates that it should work.

This menu item

 $items['milan/author/add'] = array(
    'title' => 'Add Author',
    'page callback' => 'get_author_form',
    'access arguments' => array('access content'),
    'file' => 'author.pages.inc',
  );

calls this code

function get_author_form() {
  //return node_form(NULL,NULL);
  //return drupal_get_form('author_form');
  return author_ajax_form('author');
}

function author_ajax_form($type) {
  global $user;
  module_load_include('inc', 'node', 'node.pages');

  $types = node_get_types();
  $type = isset($type) ? str_replace('-', '_', $type) : NULL;
  // If a node type has been specified, validate its existence.
  if (isset($types[$type]) && node_access('create', $type)) {
    // Initialize settings:
    $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => 'bbb','bbb' => 'TRUE');
    $output = drupal_get_form($type .'_node_form', $node);
  }

  return $output;
}

And here is the hook_form and hook_form_alter code

function author_form_author_node_form_alter(&$form, &$form_state) {
    $form['author']=NULL;
    $form['taxonomy']=NULL;
    $form['options']=NULL;
    $form['menu']=NULL;
    $form['comment_settings']=NULL;
    $form['files']=NULL;
    $form['revision_information']=NULL;
    $form['attachments']=NULL;
    if($form["qqq"]) {
      $form['buttons']['preview']=NULL;
    }
}

function author_form(&$node) {
  return make_author_form(&$node);
}


function make_author_form(&$node) {
  global $user;
  $type = node_get_types('type', $node);

  $node = author_make_title($node);
  drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t($node->title), 'node/' . $node->nid)));


  $form['authorset'] = array(
      '#type' => 'fieldset',
      '#title' => t('Author'),
      '#weight' => -50,
      '#collapsible' => FALSE,
      '#collapsed' => FALSE,
    );

  $form['author_id'] = array(
    '#access' => user_access('create pd_recluse entries'),
    '#type' => 'hidden',
    '#default_value' => $node->author_id,
    '#weight' => -20
  );



  $form['authorset']['last_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Last Name'),
    '#maxlength' => 60,
    '#default_value' => $node->last_name
  );

  $form['authorset']['first_name'] = array(
    '#type' => 'textfield',
    '#title' => t('First Name'),
    '#maxlength' => 60,
    '#default_value' => $node->first_name
  );

  $form['authorset']['middle_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Middle Name'),
    '#maxlength' => 60,
    '#default_value' => $node->middle_name
  );

  $form['authorset']['suffix_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Suffix Name'),
    '#maxlength' => 14,
    '#default_value' => $node->suffix_name
  );

  $form['authorset']['body_filter']['body'] = array(
      '#access' => user_access('create pd_recluse entries'),
      '#type' => 'textarea',
      '#title' => 'Describe Author',
      '#default_value' => $node->body,
      '#required' => FALSE,
      '#weight' => -19
    );


  $form['status'] = array(
    '#type' => 'hidden',
    '#default_value' => '1'
  );

  $form['promote'] = array(
    '#type' => 'hidden',
    '#default_value' => '1'
  );

  $form['name'] = array(
    '#type' => 'hidden',
    '#default_value' => $user->name
  );

  $form['format'] = array(
    '#type' => 'hidden',
    '#default_value' => '1'
  );


  // NOTE in node_example there is some addition code here not needed for this simple node-type
  $thepath='milan/author';
  if($_REQUEST["theletter"]) {
    $thepath .= "/" . $_REQUEST["theletter"];
  }

  if($node['language']) {
    $thepath='milan/authorajaxclose';
    $form['qqq'] = array(
      '#type' => 'hidden',
      '#default_value' => '1'
    );
  }

  $form['#redirect'] = $thepath;

  return $form;
}

That menu path coincides with this theme (PHPTemplate)

    
  • 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-14T21:23:24+00:00Added an answer on May 14, 2026 at 9:23 pm

    Turned out to be a basic programming error in line 4 of the make_author_form function. I was zeroing out the $node variable myself.

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

Sidebar

Related Questions

I have not been able to get my code to hit the onReceive method
So this is something that I have not been able to find any documentation
I have no code to really display here, since I have not been able
I have not been able to get the break point I have on LinkButtonDelete_Click
In my implementation of Java NIO I have not been able to get SelectionKey.attach()
I'm new to Plone and jQueryUI, and have not been able to get any
I am very new to PhoneGap yet have not been able to get some
I have tried about 6 different methods and have not been able to get
I'm new to Linq and have not been able to get this working. public
Has anyone used spring simple memcached? I have not been able to get the

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.