You are here

function custom_add_another_third_party_settings_submit in Custom add another 8

Submit callback that saves custom labels to field Third Party Settings.

1 string reference to 'custom_add_another_third_party_settings_submit'
custom_add_another_form_field_storage_config_edit_form_alter in ./custom_add_another.module
Implements hook_form_FORM_ID_alter().

File

./custom_add_another.module, line 83
Allows the 'Add another item' button text to be customised.

Code

function custom_add_another_third_party_settings_submit($form, FormStateInterface $form_state) {

  /** @var \Drupal\field\FieldConfigInterface $field */
  $field = $form_state
    ->getStorage()['field_config'];
  $field
    ->setThirdPartySetting('custom_add_another', 'custom_add_another', $form_state
    ->getValue('custom_add_another'))
    ->setThirdPartySetting('custom_add_another', 'custom_remove', $form_state
    ->getValue('custom_remove'))
    ->save();
}