daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Sep 24th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1 | Red
  2. 2 | Blue
  3. 3 | Green
  4.    
  5. /**
  6.  * Implements hook_form_FORM_ID_alter().
  7.  */
  8. function MODULE_NAME_form_YOUR_FORM_ID_alter(&$form, &$form_state) {    
  9.  
  10.   // Replace the next 5 lines with your logic to set the array of values
  11.   $options = array(
  12.     1 => 'Red',
  13.     2 => 'Blue',
  14.     3 => 'Green',
  15.   );    
  16.  
  17.   $form['FORM_ELEMENT_ID']['#type'] = 'select';
  18.   $form['FORM_ELEMENT_ID']['#options'] = $options;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top