function FieldConfigListBuilder::buildRow

Same name in other branches
  1. 9 core/modules/field_ui/src/FieldConfigListBuilder.php \Drupal\field_ui\FieldConfigListBuilder::buildRow()
  2. 8.9.x 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 135

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();
    $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,
            ],
        ],
        'class' => [
            'field-settings-summary-cell',
        ],
    ];
    $row = [
        'id' => Html::getClass($field_config->getName()),
        'data' => [
            'label' => $field_config->getLabel(),
            'field_name' => $field_config->getName(),
            'settings_summary' => $settings_summary,
        ],
    ];
    // 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.