You are here

function matrix_form_alter in Matrix field 6.2

Same name and namespace in other branches
  1. 6 matrix.module \matrix_form_alter()

Implmentation of hook_form_alter

File

./matrix.module, line 1186
Defines simple matrix field types.

Code

function matrix_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'content_field_edit_form' && $form['#field']['type'] == 'matrix') {
    $form['field']['required']['#type'] = 'hidden';

    // Required is implemented on a per-field basis
    switch ($form['#field']['widget']['type']) {
      case 'matrix':
        $form['field']['multiple']['#type'] = 'hidden';

        // Required is implemented on a per-field basis
        break;
      case 'table':

        // Tables always have items as rows
        $form['field']['mode']['#type'] = 'hidden';
        $form['field']['rows']['#type'] = 'hidden';
        break;
    }
  }
}