1

I have a custom entity reference field working well, but once I added the category to it the other entity reference fields appeared in the same category.

enter image description here

Here is my code:

/**
 * Plugin implementation of the 'region_token' field type.
 *
 * @FieldType(
 *   id = "region_token",
 *   label = @Translation("Region Token"),
 *   description = @Translation("Region custom token."),
 *   category = @Translation("Tokens"),
 *   default_widget = "region_select_widget",
 *   default_formatter = "region_formatter",
 * )
 */
class RegionToken extends EntityReferenceItem {

Any idea about how to fix this?

2

I fixed the problem by adding the following code to the class

  /**
   * {@inheritdoc}
   */
  public static function getPreconfiguredOptions() {
    return [];
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.