fieldSettingsSummary example

$summary[] = new TranslatableMarkup('Reference type: @entity_type', [
        '@entity_type' => $target_type_info->getLabel(),
      ]);
    }
    return $summary;
  }

  /** * {@inheritdoc} */
  public static function fieldSettingsSummary(FieldDefinitionInterface $field_definition): array {
    $summary = parent::fieldSettingsSummary($field_definition);
    $target_type = $field_definition->getFieldStorageDefinition()->getSetting('target_type');
    $handler_settings = $field_definition->getSetting('handler_settings');

    if (!isset($handler_settings['target_bundles'])) {
      return $summary;
    }

    /** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_bundle_information */
    $entity_bundle_information = \Drupal::service('entity_type.bundle.info');
    $bundle_info = $entity_bundle_information->getBundleInfo($target_type);
    $bundles = array_map(fn($bundle) => $bundle_info[$bundle]['label']$handler_settings['target_bundles']);
    

    return [];
  }

  /** * {@inheritdoc} */
  public function getFieldSettingsSummary(FieldDefinitionInterface $field_definition): array {
    $plugin_definition = $this->getDefinition($field_definition->getType(), FALSE);
    if (!empty($plugin_definition['class'])) {
      $plugin_class = DefaultFactory::getPluginClass($field_definition->getType()$plugin_definition);
      return $plugin_class::fieldSettingsSummary($field_definition);
    }
    return [];
  }

  /** * {@inheritdoc} */
  public function getUiDefinitions() {
    $definitions = $this->getDefinitions();

    // Filter out definitions that can not be configured in Field UI.
Home | Imprint | This part of the site doesn't use cookies.