getStorageSettingsSummary example


    return $header + parent::buildHeader();
  }

  /** * {@inheritdoc} */
  public function buildRow(EntityInterface $field_config) {
    /** @var \Drupal\field\FieldConfigInterface $field_config */
    $field_storage = $field_config->getFieldStorageDefinition();

    $storage_summary = $this->fieldTypeManager->getStorageSettingsSummary($field_storage);
    $instance_summary = $this->fieldTypeManager->getFieldSettingsSummary($field_config);
    $summary_list = [...$storage_summary, ...$instance_summary];

    $settings_summary = [
      'data' => [
        '#theme' => 'item_list',
        '#items' => [
          $this->fieldTypeManager->getDefinitions()[$field_storage->getType()]['label'],
          ...$summary_list,
        ],
      ],
      
$form['add'] = [
      '#type' => 'container',
      '#attributes' => ['class' => ['form--inline', 'clearfix']],
    ];

    $bundles = $this->bundleInfoService->getAllBundleInfo();
    $existing_field_storage_options = $this->getExistingFieldStorageOptions();

    $rows = [];
    foreach ($existing_field_storage_options as $field) {
      $field_bundles = $field['field_storage']->getBundles();
      $summary = $this->fieldTypePluginManager->getStorageSettingsSummary($field['field_storage']);
      $cardinality = $field['field_storage']->getCardinality();
      $readable_cardinality = $cardinality === -1 ? $this->t('Unlimited') : new PluralTranslatableMarkup(1, 'Single value', 'Multiple values: @cardinality', ['@cardinality' => $cardinality]);

      // Remove empty values.       $list = array_filter([...$summary$readable_cardinality]);
      $settings_summary = [
        '#theme' => 'item_list',
        '#items' => $list,
        '#attributes' => [
          'class' => ['field-settings-summary-cell'],
        ],
      ];
$usage[] = Link::fromTextAndUrl($this->bundles[$entity_type_id][$bundle]['label']$route_info)->toRenderable();
      }
      else {
        $usage[] = $this->bundles[$entity_type_id][$bundle]['label'];
      }
    }
    $row['data']['usage']['data'] = [
      '#theme' => 'item_list',
      '#items' => $usage,
      '#context' => ['list_style' => 'comma-list'],
    ];
    $summary = $this->fieldTypeManager->getStorageSettingsSummary($field_storage);
    $row['data']['settings_summary'] = empty($summary) ? '' : [
      'data' => [
        '#theme' => 'item_list',
        '#items' => $summary,
      ],
      'class' => ['storage-settings-summary-cell'],
    ];
    return $row;
  }

}
Home | Imprint | This part of the site doesn't use cookies.