function paragraphs_field_ui_preconfigured_options_alter

File

paragraphs/paragraphs.module, line 205
Contains paragraphs.module

Code

function paragraphs_field_ui_preconfigured_options_alter(array &$options, $field_type) {
  if (version_compare(\Drupal::VERSION, '10.2', '<')) {
    return;
  }

  // Move the preconfigured paragraph option to the generic category so it is available
  // as a top-level option in the new field type selection UI in Drupal 10.2+.
  if ($field_type == 'entity_reference_revisions' && !empty($options['paragraph'])) {
    $options['paragraph']['weight'] = -15;
    $options['paragraph']['category'] = FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY;
    $options['paragraph']['label'] = t('Paragraphs');
    $options['paragraph']['description'] = t('Create structured content.');
  }
}