<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
While it makes sense to prefer the for hook_form_FORM_ID_alter(), it
is called before the more<br>
general hook_form_alter() so if you want to run after all other
alterations you need to use hook_form_alter() .<br>
Also since CCK uses hook_form_alter(), if you want to run after it
you need to use hook_form_alter().<br>
<br>
Nevets<br>
<br>
On 1/18/2011 8:21 AM, John Fiala wrote:
<blockquote
cite="mid:AANLkTinFG5GiVZDkh3_rzCjq67DtkhG3PsEp9ziQNEsU@mail.gmail.com"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 13px;"
lang="x-western">
<pre wrap="">On Tue, Jan 18, 2011 at 6:16 AM, Leonard den Ottolander.nl
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:drupal@den.ottolander.nl"><drupal@den.ottolander.nl></a> wrote:
</pre>
<blockquote type="cite" style="color: rgb(0, 0, 0);">
<pre wrap=""><span class="moz-txt-citetags">> </span>Hello Jamie,
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>On Tue, 2011-01-18 at 07:29 -0500, Jamie Holly wrote:
</pre>
<blockquote type="cite" style="color: rgb(0, 0, 0);">
<pre wrap=""><span class="moz-txt-citetags">>> </span>The trick is to set the
<span class="moz-txt-citetags">>> </span>weight of your module higher than the weight of the menu module so that
<span class="moz-txt-citetags">>> </span>the hook runs after menu's hook_form_alter.
</pre>
</blockquote>
<pre wrap=""><span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Right. That did the trick. Thanks!
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>The fact that I saw no explicit hooking confused me. I assume every
<span class="moz-txt-citetags">> </span>module hooks to the forms using <module name>_form_alter implicitly?
</pre>
</blockquote>
<pre wrap="">Exactly. Knowing how to use the hook_form_alter hooks properly makes
customizing Drupal much easier.
Each time a form is built, it gets sent through every hook_form_alter
implementation in every active Drupal Module. And, as FGM pointed it,
it also goes through a specific hook: hook_form_FORM_ID_alter. Have a
look at both of these and play around with them. I personally prefer
to use the second one, because it's more specific and obvious what it
does, and you don't get one of those huge if/switch statements in the
hook... but sometimes you need to use hook_form_alter because your
changes apply across a couple of related forms, especially the node
forms.
<div class="moz-txt-sig">--
John Fiala
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.jcfiala.net">www.jcfiala.net</a>
</div></pre>
</div>
</blockquote>
<br>
</body>
</html>