[development] Adding to Profile forms - is hardcoding the only
way?
Heine Deelstra
info at ustilago.org
Fri Aug 11 09:53:29 UTC 2006
On Fri, 11 Aug 2006 09:10:37 +0200, Carl Mc Dade <carl_mcdade at yahoo.com>
wrote:
> Which produces results while nothing else in the docs or forum worked.
> The problem is while it does add text to the form it does not alter it.
> The description stays the same and the added text appears at the top of
> the form. The second problem is that the extra text seems to exist in
> its own array and stays at the top. Manipulating the array only moves
> the profile module fields and leaves the added text at the top.
> Everyone says use form _ alter but there is no documentation or
> examples of its use in the wild.
Drupal & modules being open source, there are a lot of examples (not all
very good, mind you).
Here's an example form_alter for the profile field named
'profile_firstname' in the category 'Personal'
function scratch_form_alter($form_id, &$form) {
if ($form_id == 'user_edit') {
// Check whether we are at the right page
if (isset($form['Personal'])) {
// Modify
$form['Personal']['profile_firstname']['#description'] =
'Descriptions are not check_plained!';
// Or unset, all works
unset($form['Personal']['profile_firstname']);
}
}
}
If you do decide to file a bug report, please give full 'steps to
reproduce' and what it is you are trying to do.
Regards,
Heine
More information about the development
mailing list