Can't uninstall module because of checkbox field I've a custom module that alters the MenuLinkContent entity by adding a field. My field is defined as follow.

/**
 * Implements hook_entity_base_field_info().
 */
function svg_icon_menu_link_entity_base_field_info(EntityTypeInterface $entity_type) {

  $fields = array();

  if ( $entity_type-&gt;get('id') !== 'menu_link_content' ) {
    return $fields;
  }

  $fields['hide_label'] = BaseFieldDefinition::create('boolean')
    -&gt;setLabel(t('Hide label'))
    -&gt;setDescription(t('Display only the icon.'))
    -&gt;setDisplayOptions('form', array(
      'type' =&gt; 'checkbox',
      'weight' =&gt; 0
    ));

  return $fields;
}


By default the checkbox is saved in the DB with a value of 0 if unchecked, and with a value of 1 if checked. To Drupal there's always a value for that field, that's why it prevent me to uninstall the module with the message There is data for the field hide_label on entity type Custom menu link.

How should I manage this situation? Should I save a value of NULL if unchecked in some way, or should I have to do something when uninstalling my custom module?
You could create a custom form and set all the field values to NULL in the submit handler. 

For example:

&lt;?php

namespace Drupal\mymodule\Form;

use Drupal;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;

class TestForm extends FormBase {

  public function getFormId() {
    return 'test_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = [
      'test' =&gt; [
        '#type' =&gt; 'submit',
        '#value' =&gt; 'Clear field values',
      ],
    ];

    return $form;
  }

  public function submitForm(array &amp;$form, FormStateInterface $form_state) {
    $query = Drupal::entityQuery('node');
    $query-&gt;condition('type', 'menu_link_content');
    $result = $query-&gt;execute();

    $nodes = Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;loadMultiple($result);

    foreach ($nodes as $node) {
      if ($node instanceof Node) {
        $node-&gt;set('your_field', NULL);
        $node-&gt;save();
      }
    }
  }

}