Increase the number of values for FIELD SETTINGS 'multiple / multi-value' field in Durpal 7.

In this tuoterial we learn, how to Increase the number of values of field setting in drupal 7.

Increase the number of values of field setting

We can increase it's value by alter field_ui_field_edit_form in our custom module by implements hook_form_FORM_ID_alter().

Example:

/**
 * Implements hook_form_FORM_ID_alter
 */
function module_name_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
  // Increase the max cardinality to 20
  $range = drupal_map_assoc(range(1, 20));
  $new_options = array(FIELD_CARDINALITY_UNLIMITED => t('Unlimited')) + $range;

  // Change the options
  $form['field']['cardinality']['#options'] = $new_options;
}

Clear the cache, Go to the field setting page, we increase the values for FIELD SETTINGS and now we can set the limit up to 20.

Increase the number of values of field setting

Note: after implements any hook clear the cache

Tags