function taxonomy_post_update_configure_status_field_widget

Add status with settings to all form displays for taxonomy entities.

File

core/modules/taxonomy/taxonomy.post_update.php, line 351

Code

function taxonomy_post_update_configure_status_field_widget(&$sandbox = NULL) {
  \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'entity_form_display', function (EntityDisplayInterface $entity_form_display) {
    // Only update taxonomy term entity form displays with no existing options
    // for the status field.
    if ($entity_form_display->getTargetEntityTypeId() == 'taxonomy_term' && empty($entity_form_display->getComponent('status'))) {
      $entity_form_display->setComponent('status', [
        'type' => 'boolean_checkbox',
        'settings' => [
          'display_label' => TRUE,
        ],
      ]);
      return TRUE;
    }
    return FALSE;
  });
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.