public function FieldConfigListBuilder::buildRow in Drupal 9
Same name and namespace in other branches
- 8 core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::buildRow()
- 10 core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::buildRow()
Builds a row for an entity in the entity listing.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.
Return value
array A render array structure of fields for this entity.
Overrides EntityListBuilder::buildRow
See also
\Drupal\Core\Entity\EntityListBuilder::render()
File
- core/
modules/ field_ui/ src/ FieldConfigListBuilder.php, line 134
Class
- FieldConfigListBuilder
- Provides lists of field config entities.
Namespace
Drupal\field_uiCode
public function buildRow(EntityInterface $field_config) {
/** @var \Drupal\field\FieldConfigInterface $field_config */
$field_storage = $field_config
->getFieldStorageDefinition();
$route_parameters = [
'field_config' => $field_config
->id(),
] + FieldUI::getRouteBundleParameter($this->entityTypeManager
->getDefinition($this->targetEntityTypeId), $this->targetBundle);
$row = [
'id' => Html::getClass($field_config
->getName()),
'data' => [
'label' => $field_config
->getLabel(),
'field_name' => $field_config
->getName(),
'field_type' => [
'data' => [
'#type' => 'link',
'#title' => $this->fieldTypeManager
->getDefinitions()[$field_storage
->getType()]['label'],
'#url' => Url::fromRoute("entity.field_config.{$this->targetEntityTypeId}_storage_edit_form", $route_parameters),
'#options' => [
'attributes' => [
'title' => $this
->t('Edit field settings.'),
],
],
],
],
],
];
// Add the operations.
$row['data'] = $row['data'] + parent::buildRow($field_config);
if ($field_storage
->isLocked()) {
$row['data']['operations'] = [
'data' => [
'#markup' => $this
->t('Locked'),
],
];
$row['class'][] = 'menu-disabled';
}
return $row;
}