You are here

function matrix_form_field_ui_field_edit_form_alter in Matrix field 8.2

Same name and namespace in other branches
  1. 7.2 matrix.admin.inc \matrix_form_field_ui_field_edit_form_alter()

Implementation of hook_form_FORM_ID_alter()

File

./matrix.admin.inc, line 699
Configuration pages for matrix field

Code

function matrix_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#field']['module'] != 'matrix') {
    return;
  }
  $form['#submit'][] = 'matrix_clear_cache_submit';

  //Add a submit handler to ensure that the temp cache is cleared

  //The module can only work if cardinality is set to unlimited

  //This overrides the form element removing it from the UI
  $form['field']['cardinality'] = array(
    '#type' => 'value',
    '#value' => FIELD_CARDINALITY_UNLIMITED,
  );

  //The module can only work if required is set to FALSE.

  //Depending on the widget, the required attribute is controlled seperately
  $form['instance']['required'] = array(
    '#type' => 'value',
    '#value' => FALSE,
  );
}