You are here

function profile_form_field_config_edit_form_submit in Profile 8

Form submission handler for profile_form_field_config_edit_form_alter.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

1 string reference to 'profile_form_field_config_edit_form_submit'
profile_form_field_config_edit_form_alter in ./profile.module
Implements hook_form_FORM_ID_alter().

File

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

Code

function profile_form_field_config_edit_form_submit(array $form, FormStateInterface $form_state) {
  $field = $form_state
    ->getFormObject()
    ->getEntity();
  $form_fields =& $form_state
    ->getValues();

  // If the private option is checked, update settings.
  if ($form_fields['profile_private']) {
    $field
      ->setThirdPartySetting('profile', 'profile_private', TRUE);
    $field
      ->save();
  }
  else {
    $field
      ->unsetThirdPartySetting('profile', 'profile_private');
    $field
      ->save();
  }
}