/**
  * {@inheritdoc}
  */
 public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data)
 {
     $element = parent::storageSettingsForm($form, $form_state, $has_data);
     $lists = mailchimp_get_lists();
     $options = array('' => t('-- Select --'));
     foreach ($lists as $mc_list) {
         $options[$mc_list['id']] = $mc_list['name'];
     }
     $field_map = \Drupal::entityManager()->getFieldMap();
     $field_definitions = array();
     foreach ($field_map as $entity_type => $fields) {
         $field_definitions[$entity_type] = \Drupal::entityManager()->getFieldStorageDefinitions($entity_type);
     }
     // Prevent MailChimp lists that have already been assigned to a field
     // appearing as field options.
     foreach ($field_map as $entity_type => $fields) {
         foreach ($fields as $field_name => $field_properties) {
             if ($field_properties['type'] == 'mailchimp_lists_subscription') {
                 /* @var $field \Drupal\field\Entity\FieldStorageConfig */
                 $field = $field_definitions[$entity_type][$field_name];
                 $field_settings = $field->getSettings();
                 if ($field_name != $this->getFieldDefinition()->getName() && isset($field_settings['mc_list_id'])) {
                     unset($options[$field_settings['mc_list_id']]);
                 }
             }
         }
     }
     $refresh_lists_url = Url::fromRoute('mailchimp_lists.refresh');
     $mailchimp_url = Url::fromUri('https://admin.mailchimp.com', array('attributes' => array('target' => '_blank')));
     $element['mc_list_id'] = array('#type' => 'select', '#title' => t('MailChimp List'), '#multiple' => FALSE, '#description' => t('Available MailChimp lists which are not already
     attached to Mailchimp Subscription Fields. If there are no options,
     make sure you have created a list at !MailChimp first, then !cacheclear.', array('!MailChimp' => \Drupal::l('MailChimp', $mailchimp_url), '!cacheclear' => \Drupal::l('clear your list cache', $refresh_lists_url))), '#options' => $options, '#default_value' => $this->getSetting('mc_list_id'), '#required' => TRUE, '#disabled' => $has_data);
     $element['double_opt_in'] = array('#type' => 'checkbox', '#title' => 'Require subscribers to Double Opt-in', '#description' => 'New subscribers will be sent a link with an email they must follow to confirm their subscription.', '#default_value' => $this->getSetting('double_opt_in'), '#disabled' => $has_data);
     $element['send_welcome'] = array('#type' => 'checkbox', '#title' => 'Send a welcome email to new subscribers', '#description' => 'New subscribers will be sent a welcome email once they are confirmed.', '#default_value' => $this->getSetting('send_welcome'), '#disabled' => $has_data);
     return $element;
 }