You are here

function _maxlength_cck_form_submit in Maxlength 7.2

Same name and namespace in other branches
  1. 6.2 maxlength.inc \_maxlength_cck_form_submit()
  2. 7 maxlength.inc \_maxlength_cck_form_submit()
1 string reference to '_maxlength_cck_form_submit'
_maxlength_cck_form_alter in ./maxlength.inc

File

./maxlength.inc, line 116
Business logic for maxlength

Code

function _maxlength_cck_form_submit($form, &$form_state) {
  $type = isset($form['instance']['bundle']['#value']) ? $form['instance']['bundle']['#value'] : '';
  if (strpos($form['instance']['field_name']['#value'], 'field_') === 0) {
    variable_set('maxlength_' . $form['instance']['field_name']['#value'], $form_state['values']['field']['settings']['max_length']);
    variable_set('maxlength_' . $form['instance']['field_name']['#value'] . '_js', $form_state['values']['field']['settings']['maxlength_' . $form['instance']['field_name']['#value'] . '_js']);
    variable_set('maxlength_' . $form['instance']['field_name']['#value'] . '_text', $form_state['values']['field']['settings']['maxlength_' . $form['instance']['field_name']['#value'] . '_text']);
  }
  elseif ($type != '') {
    variable_set('maxlength_' . $form['instance']['field_name']['#value'] . '_' . $type, $form_state['values']['field']['settings']['max_length']);
    variable_set('maxlength_' . $form['instance']['field_name']['#value'] . '_js_' . $type, $form_state['values']['field']['settings']['maxlength_' . $form['instance']['field_name']['#value'] . '_js']);
    variable_set('maxlength_' . $form['instance']['field_name']['#value'] . '_text_' . $type, $form_state['values']['field']['settings']['maxlength_' . $form['instance']['field_name']['#value'] . '_text']);
  }
}