Skip to content

Instantly share code, notes, and snippets.

@yannickoo
Created July 17, 2014 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yannickoo/835f1eff883977eab520 to your computer and use it in GitHub Desktop.
Save yannickoo/835f1eff883977eab520 to your computer and use it in GitHub Desktop.
Extends Drupal's field cardinality select list 20 values.
<?php
/**
* Implements hook_form_alter().
*/
function mymmodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'field_ui_field_edit_form') {
$form['field']['cardinality']['#options'] = array('-1' => t('Unlimited')) + drupal_map_assoc(range(1, 20));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment