Drupal, hook_form_alter add field in node edit / create
Drupal, hook_form_alter add field in node edit / create I have a node and I need to populate a field programmatically, so here is what I do : $campaigns = $client->get_campaigns(); $tab_campaign = array(""=>"Dernière newsletter"); foreach ($campaigns->response as $camp){ $tab_campaign[$camp->CampaignID] = $camp->Name; } $form['field_last_newsletter'] = array( '#type' => 'select', '#required' => true, '#options' => $tab_campaign, '#title' => 'Choisir la dernière newsletter', ); } This work, I have my select field populated but when I select one and click on save nothing is saved, if I come back to the edit page the select have the default value, what I am doing wrong ? Thanks. 2 Answers 2 I think you're looking for a allowed_values_function s...
