Commit 17aae5de authored by Erik Stielstra's avatar Erik Stielstra Committed by Erik Stielstra
Browse files

Issue #3280474 by Sutharsan: Hide the deprecated field type when not in use

parent 55e2b254
Loading
Loading
Loading
Loading
+7 −3
Changes for README.txt: 7 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -40,9 +40,13 @@ Radioactivity field (deprecated)
  updates the energy values while the node is being edited.
  See https://www.drupal.org/project/radioactivity/issues/3106687

  The Radioactivity field is deprecated in 4.0.x and will be removed in the 5.0
  release. Use the Radioactivity Reference field (above) when you start with
  Radioactivity module.
  NOTE that this field is only available when your site is already using it. On
  new sites it is not listed in the select list when you add a field to an
  entity. It is only available for legacy purposes.

  The Radioactivity field was deprecated in 4.0.0 and will be removed in the
  5.0.0 release. You are encouraged to use the Radioactivity Reference field
  (above) instead.

Field formatters

+16
Changes for radioactivity.module: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -155,6 +155,22 @@ function radioactivity_form_field_config_edit_form_alter(array &$form, FormState
  }
}

/**
 * Implements hook_form_FORM_ID_alter() for 'field_ui_field_storage_add_form'.
 *
 * @todo Remove in 5.0.0 when the deprecated 'radioactivity' field gets removed.
 */
function radioactivity_form_field_ui_field_storage_add_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  // Hide the deprecated radioactivity field type when no field of this type is
  // currently being used.
  $map = \Drupal::service('entity_field.manager')
    ->getFieldMapByFieldType('radioactivity');
  if (empty($map)) {
    unset($form['add']['new_storage_type']['#options']['General']['radioactivity']);
  }
}

/**
 * Implements hook_queue_info_alter().
 */