Problem/Motivation

In FieldTypePluginManager we have this code

  /**
   * {@inheritdoc}
   */
  public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label') {
    $grouped_categories = $this->getGroupedDefinitionsTrait($definitions, $label_key);
    $category_info = \Drupal::moduleHandler()->invokeAll('field_type_category_info');
    foreach ($grouped_categories as $group => $definitions) {
      if (!isset($category_info[$group]) && $group !== static::DEFAULT_CATEGORY) {
        assert(FALSE, "\"$group\" must be defined in hook_field_type_category_info().");
        $grouped_categories[static::DEFAULT_CATEGORY] += $definitions;
        unset($grouped_categories[$group]);
      }
    }

    return $grouped_categories;
  }

With the asser(FALSE) here we're causing an Assertion error for any module that defines a field type plugin with its own category that isn't yet backed by a field_type_category_info hook.

We should instead be triggering a deprecation error so modules know they need to update

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

larowlan created an issue. See original summary.

larowlan’s picture

lauriii’s picture

There's a deprecation error triggered in \Drupal\Core\Field\FieldTypePluginManager::processDefinition. As a BC layer, it moves all of the @Translation defined types to 'general' so this assertion should only trigger when you are explicitly referencing a group, or have forgotten to use @Translation.

larowlan’s picture

Status: Active » Closed (works as designed)

I missed that, this works as designed then 💙