By carlmcdade on
I have been trying to change the add node form but node-form, the name of the form does not seem to respond to hook_form_alter. Is this a bug or is there another name that can be used in the code?
/**
* Implementation of hook_form_alter().
*/
function flashgame_form_alter($form_id, &$form) {
if ($form_id == 'node_form'){
unset($form['title']);
}
}
Comments
Also tried with:
Also tried with:
and
without any luck
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
Because the form_id is not
Because the form_id is not node_form, but [content type]_node_form eg. story_node_form for the story node submission form.
To circumvent check whether $form['#id'] is node-form or $form['#base'] (5.x) is node_form.
Yet another possibility is to check $form_id == $form['type']['#value']_node_form (add the necessary isset checks).
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Thanks that got. Is there a
Thanks that got. Is there a handbook page or API doc on this? The only thing I found seemed the pertain to phptemplate and not hook_form_alter.
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
Apart from some examples in
Apart from some examples in core code and reading node module / api.drupal.org, not that I know.
You can however download a 4.7 version of Form Inspect from
svn://heine.familiedeelstra.com/public/modules/devel_forminspect(subversion required). Depends on the devel module.Form Inspect basically provides an automatic var_dump of the current forms array.
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
another small question in
another small question in the same line.
Does not seem to go with the droplist of terms. While $form['taxonomy'] does exist and can be altered I cannot get in contact with its children.
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
I'd guess your changes are
I'd guess your changes are overwritten by taxonomy module (if it has the same weight as flashgame.module, it will run later).
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Hmm, Tried changing the load
Hmm,
Tried changing the load weight but got nothing.
Inspector is only 5.0x and all our sites are 4.7. Have any idea if inspector will work with the backport module installed?
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
4.7
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Okay, got it from svn and
Okay, got it from svn and installed. But you know what? It sees every element array except for those that come from taxonomy module.
I have a droplist with terms that just does not show upon inspection of the $form array.
Menu settings also does not appear in the arrays. I tried grabbing them with form_alter and got nothing.
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
Weight
Thanks.
Small error in the install file (that's what you get when renaming).
To remedy, execute the query:
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Yeah, I caught that and set
Yeah, I caught that and set the weight to 89 after the devel module manually. I set the weight of flashgame.module to 90 and then saved the configuration a cople of times. Nothing changed :(
Very frustrating.
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
Then I can't help you
Then I can't help you without seeing further code & more info.
I see both taxonomy and menu just fine.
Just note that the taxonomy structure is
['taxonomy'][$vid] = array( ... select element ... );
So, when you just want to overwrite the description of vocabulary 2 you'll need
Your example above would overwrite the definition.
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
thanks, Here is the code I
thanks,
Here is the code I am using now followed in the next post with the outpu from form inspect.
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
form inspect output
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
form inspect? I tried with
form inspect? I tried with the default page module and some taxonomy and saw nothing there or in menu. So it might be the 4.7 version of form inspect does not have the capability to see them?
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S
Solved. Okay, so it was my
Solved.
Okay, so it was my db connection. When I made the changes in weight I saw them but Drupal was connected to a different database. Someone changed the db connection so when I copied the files locally to my machine I was still connecting to the older version of the database.
Thanks heine for all the help.
Hiveminds Magazine
http://www.hiveminds.co.uk
for web publishers and community builders CMS Demo Matrix
Coming soon!Drupal Support | Drupal S