Created
February 22, 2012 13:23
-
-
Save opi/1885165 to your computer and use it in GitHub Desktop.
D6: Alter cck multiple value field. Not really sure this is the good way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implementation of hook_form_alter(). | |
*/ | |
function mymodule_form_alter(&$form, $form_state, $form_id) { | |
// Appelé la 1ere fois, sur node/add/mycontenttype | |
if($form_id == 'mycontenttype_node_form') { | |
foreach($form['field_my_field'] as $k => $v) { | |
if (is_numeric($k)) { | |
$form['field_my_field'][$k]['#autocomplete_path'] = 'my-autocomplete-path'; | |
} | |
} | |
} | |
// appelé a chaque "Add another item" sur field_my_field | |
elseif ($form_id == 'content_add_more_js' && isset($form['field_my_field'])) { | |
foreach($form['field_my_field'] as $k => $v) { | |
if (is_numeric($k)) { | |
$form['field_my_field'][$k]['#autocomplete_path'] = 'my-autocomplete-path'; | |
} | |
} | |
} | |
} // mymodule_form_alter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment