You are here

function menu_link_form_field_ui_field_storage_edit_form_alter in Menu Link (Field) 2.0.x

Same name and namespace in other branches
  1. 8 menu_link.module \menu_link_form_field_ui_field_storage_edit_form_alter()

Implements hook_form_FORM_ID_alter().

File

./menu_link.module, line 13
Provides a menu link field.

Code

function menu_link_form_field_ui_field_storage_edit_form_alter(&$form, FormStateInterface $form_state) {
  if ($form['#field']
    ->getType() === 'menu_link') {

    // We only support posting one menu link at a time.
    // @todo - this is a hack and should be managed by the field definition.
    // https://www.drupal.org/node/2403703
    $form['field_storage']['cardinality_container']['cardinality']['#default_value'] = 1;
    $form['field_storage']['cardinality_container']['#access'] = FALSE;
  }
}