function FieldStorageConfigListBuilder::buildRow
Same name in other branches
- 9 core/modules/field_ui/src/FieldStorageConfigListBuilder.php \Drupal\field_ui\FieldStorageConfigListBuilder::buildRow()
- 8.9.x core/modules/field_ui/src/FieldStorageConfigListBuilder.php \Drupal\field_ui\FieldStorageConfigListBuilder::buildRow()
- 10 core/modules/field_ui/src/FieldStorageConfigListBuilder.php \Drupal\field_ui\FieldStorageConfigListBuilder::buildRow()
Overrides EntityListBuilder::buildRow
File
-
core/
modules/ field_ui/ src/ FieldStorageConfigListBuilder.php, line 111
Class
- FieldStorageConfigListBuilder
- Defines a class to build a listing of fields.
Namespace
Drupal\field_uiCode
public function buildRow(EntityInterface $field_storage) {
if ($field_storage->isLocked()) {
$row['class'] = [
'menu-disabled',
];
$row['data']['id'] = $this->t('@field_name (Locked)', [
'@field_name' => $field_storage->getName(),
]);
}
else {
$row['data']['id'] = $field_storage->getName();
}
$entity_type_id = $field_storage->getTargetEntityTypeId();
// Adding the entity type.
$row['data']['entity_type'] = $entity_type_id;
$field_type = $this->fieldTypes[$field_storage->getType()];
$row['data']['type'] = $this->t('@type (module: @module)', [
'@type' => $field_type['label'],
'@module' => $field_type['provider'],
]);
$usage = [];
foreach ($field_storage->getBundles() as $bundle) {
if ($route_info = FieldUI::getOverviewRouteInfo($entity_type_id, $bundle)) {
$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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.