hook_form_alter

Events happening in the community are now at Drupal community events on www.drupal.org.

Omega template.php vs. preprocess/process

Posted by python1340 on May 23, 2012 at 4:28pm

From what I understand, the proper place to put code to alter a form is in hook_form_alter. So I created a function mytheme_alpha_form_alter() and put it in template.php. Everything works fine, however the comments in template.php suggest that I should keep that file "as clean as possible" and to use the preprocess and process subfolders instead. So in trying to do things the proper alpha/omega way, I created a file preprocess/preprocess-page.inc and did the form modification code inside mytheme_alpha_preprocess_page(). This also works, but sure seems ugly.

Read more

Taxanomi spårlöst försvunnen i node_form vid hook_form_alter

Posted by kleve on November 30, 2010 at 8:54am

Hej

Har skrivit en liten modul som med hjälp av hook_form_alter tar Taxanomiernas olika vokabulär och lägger dessa i två olika fieldsets istället för Taxanomiernas default fieldset, detta för att dela upp vokabulären i node_form-formuläret. Jag har tagit scroll-listorna som ligger i $form['taxonomy'], flyttat dessa till nya fieldsets och sedan dolt $form['taxonomy']. Detta fungerar lokalt och på en testserver men när modulen läggs upp på produktionsserver så fungerar det inte.

Read more

Editing profile node as part of /user/%uid/edit page

Posted by sibaz on October 26, 2010 at 3:40pm

I need to give a seamless implementation of a site, where users can edit a number of bits of information about themselves. The Default form in content_profile is to add tabs (primary or secondary) to the /user/%uid pages. The content_profile_registration module does it right, it allows you to tick a box, and so add the fields to the registration form, using hook_form_alter, to add fields to the 'user_register' form.

Is there a module which does the same for the user_profile_form? or hook_user($op=form, $category=account);

Read more

How to use AHAH inside a form_alter hook?

Posted by altrugon on October 20, 2010 at 5:26pm

I'm trying to add AHAH functionality inside a hook_form_alter() to be able to add an icon next to the block titles.

Here is how all this procedure works:

Read more

Lightweight electronic portfolio

Posted by kassissieh on December 3, 2009 at 8:13pm

I am using Drupal's blog module to provide a lightweight electronic portfolio tool to students and teachers. I could use your feedback on the approach I've taken using content_access and hook_form_alter. Is this the best/safest way to do this? I still feel like a relative newbie to making these modifications.

For a fuller example of the reason for using blog as a portfolio, please see http://www.kassblog.com/item/1030

I added a checkbox field to the blog content type.

Only local images are allowed.

<?php

Read more

Which is more efficient - hook_form_alter or hook_menu_alter - for replacing a single page?

Posted by jersu on October 31, 2008 at 5:57pm

I'm replacing a single page from a contributed module. The page is currently rendered with a call to drupal_get_form() from a path like foo/%node/bar

My first thought was to replace the page with hook_form_alter, unset the form elements, and replace with my own content. But I thought that would require a whole lot of preprocessing on the form that I would just discard.

So, my next thought was to just redirect the path to my own function with hook_menu_alter. But, is this less efficient because of the dynamic nature of the path?

I'm just curious if anyone has experience with this.

Read more

Sức mạnh hook_form_alter

Posted by thehong on November 27, 2007 at 4:01pm

hook_form_alter là một công cụ cực kỳ mạnh mà Drupal cung cấp. Chúng ta có thể sử dụng nó để thực hiện được nhiều việc, tưởng chừng như không thể: Thay đổi cấu trúc một form mà không cần sửa mã nguồn, định dạng form, thêm kịch bản xử lý cá nhân vào form hệ thống, ...

Read more
Subscribe with RSS Syndicate content

AltStyle によって変換されたページ (->オリジナル) /