You are here

function profile_form_field_config_edit_form_alter in Profile 8

Implements hook_form_FORM_ID_alter().

File

./profile.module, line 159
Support for configurable user profiles.

Code

function profile_form_field_config_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $field = $form_state
    ->getFormObject()
    ->getEntity();
  if ($field
    ->getTargetEntityTypeId() != 'profile') {
    return;
  }
  $form['field']['profile']['profile_private'] = [
    '#type' => 'checkbox',
    '#title' => t('This is a private field.'),
    '#default_value' => $field
      ->getThirdPartySetting('profile', 'profile_private', FALSE),
  ];
  $form['actions']['submit']['#submit'][] = 'profile_form_field_config_edit_form_submit';
}