Questions tagged [drupal-alter]

drupal_alter() is a function that allows modules to alter the data structures used by other modules.

The function is used to invoke the implementation of hook_$type_alter() made from other modules. Such hooks are used to allow third-party modules to alter the data used by a module, and they should replace the custom hooks before used on Drupal 5, where drupal_alter() was not used.

17 questions
14
votes
5 answers

Checking whether a user already exists in drupal

When a user enters his login information and hits submit, i want to check if the user already exists or not. So, i have the following two questions 1. Which hook is needed to be implemented , for the case when user hits the submit button on the…
simonr
  • 141
  • 1
  • 1
  • 3
4
votes
2 answers

How do I update a node (book or Page) before saving it without touching the module code in Drupal?

I would like to set some values in the node before actually writing the data to the DB. I already have it working by modifying book_nodeapi but I would like to do it from outside the code, some _alter option that allows me to leave the module code…
German
  • 43
  • 2
4
votes
2 answers

Default values for Content Taxonomy fields in Drupal with Hierarchical Select widget

I'm trying to set the default value for a Content Taxonomy field in a hook_form_alter, but can't pin down the necessary format. I've tried this and many variations: foreach (element_children($form) as $child) { // Set $default_value. if…
lazysoundsystem
  • 2,039
  • 23
  • 23
4
votes
2 answers

How to override form action in Drupal?

I originally started this question in another thread, but that thread was sorta, kinda answered, and now I primarily want to know how to specify another form action... I tried using the code below, but the form action, when output, remains…
n00b0101
  • 6,863
  • 17
  • 42
  • 36
3
votes
3 answers

form layout in drupal from a module

I created my own module called "cssswitch". I'm trying to create my own html layout to display the admin form portion of the module. I understand how to use the hook_form_alter() to modify form elements, but I need to create the entire form layout…
EricP
  • 1,459
  • 6
  • 33
  • 55
3
votes
3 answers

Drupal: adding disclaimer text above the submit button in a webform

Is there an easy-ish way to modify the webform-form-tpl.php template to show disclaimer text above the submit button in a Drupal webform? I can add text below the button, but do not know how to split up the button from the other elements to add text…
james6848
  • 1,657
  • 3
  • 25
  • 39
2
votes
2 answers

drupal module alter view or node

I have been using hook_alter to modify forms in a custom PHP module. I started to take the same approach modifying the result page of "node add" form. However this page is not a form so I don't have a form ID to hook on to. Actually it contains a…
bert
  • 287
  • 6
  • 14
1
vote
1 answer

Ajax and hook_form_alter

I'm getting a "The value you selected is not a valid choice." error for an Ajax modified field when I submit a custom altered node/add form. An "Illegal choice error is also written to the log. This a Drupal 9 version of an app that I developed…
1
vote
2 answers

Registration during content creation in Drupal?

Is there an easy way to allow a user to register as he creates content type. E.g. Let's say there is a content type called "listing". When the user clicks to on a link to create it, and he's not logged in, I want a "register" box to appear ABOVE THE…
rockstardev
  • 13,479
  • 39
  • 164
  • 296
1
vote
3 answers

Getting altered form values in drupal

I created one module in drupal name as newmodule.I use form alter to alter user registration form for adding one field location.When i submit the form, how i can get the value of the new field which i created .
Warrior
  • 5,168
  • 12
  • 60
  • 87
0
votes
1 answer

Drupal file_validate_extensions for file attachment extension using hook_form_alter

I built a module that alters form with the function called form_mods_form_alter. I want to only allow jpg, jpeg, png file types. What I have is not validating. It's allowing gif and I don't want to allow gif.
EricP
  • 1,459
  • 6
  • 33
  • 55
0
votes
1 answer

Drupal 7 change block subject in template.php

I have a block in my page and that block has a title. How can i remove this title (subject) within template.php? I tried hook_block_view_block_alter() but it doesn't seem to work? I could add a space character in the block configuration screen but…
dianikol
  • 213
  • 1
  • 4
  • 10
0
votes
2 answers

Validation on user registration form?

i have made module in which i am trying to add validation like if the user had entered the characters in "Phone No" text filed and same on "Mobile No". This will run when user had open the user registration form. I have made this....
Nitz
  • 1,690
  • 11
  • 36
  • 56
0
votes
1 answer

Problems in user - registration module in DRUPAL

I have some problem in drupal registration page. I want to change whole user registration page. in registration module i want to add new field type. Bcz i want that user can choose the date from date-time picker. I have ready date-time picker which…
Nitz
  • 1,690
  • 11
  • 36
  • 56
0
votes
1 answer

Drupal hook alter with hook validate

I have a CCK defined form called 'mytype_node_form'. I create a module called form_overrides I create a function called form_overrides_form_alter where I successfully check for $form_id = 'mytype_node_form' Question: What should be the name of my…
bert
  • 287
  • 6
  • 14
1
2