2

I have a node/add/blog form, there are some things I don't want show it. I give the elements

$form['author']['#access'] = FALSE;
$form['options']['#access'] = FALSE; 
$form['comment_settings']['#access'] = FALSE; 

but I cann't find what's the element name for menu and url setting in message of dpm($form);

1

As explained in hook_form_alter

The call order is as follows: all existing form alter functions are called for module A, then all for module B, etc., followed by all for any base theme(s), and finally for the theme itself. The module order is determined by system weight, then by module name.

Within each module, form alter hooks are called in the following order: first, hook_form_alter(); second, hook_form_BASE_FORM_ID_alter(); third, hook_form_FORM_ID_alter(). So, for each module, the more general hooks are called first followed by the more specific.

So, your module hook_form_alter is called before path module or menu module which adds those elements. That's the reason you can able to see those elements when you print form in your custom module.

Try using same form alter hook in your theme template.php it should work. It worked for me ! I can able to see path settings and menu setting. See for Seven Administration theme below.

function seven_form_alter(&$form, &$from_state, $form_id) {
  drupal_set_message("<pre>" . print_r($form, 1) . "</pre>");
}

Else, you need to alter your module weights !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.