function FieldConfigListBuilder::buildRow

Same name in other branches
  1. 9 core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::buildRow()
  2. 10 core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::buildRow()
  3. 11.x core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::buildRow()

Overrides EntityListBuilder::buildRow

File

core/modules/field_ui/src/FieldConfigListBuilder.php, line 147

Class

FieldConfigListBuilder
Provides lists of field config entities.

Namespace

Drupal\field_ui

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.