You are here

public function FieldConfigListBuilder::buildRow in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 123
Contains \Drupal\field_ui\FieldConfigListBuilder.

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 = array(
    'field_config' => $field_config
      ->id(),
  ) + FieldUI::getRouteBundleParameter($this->entityManager
    ->getDefinition($this->targetEntityTypeId), $this->targetBundle);
  $row = array(
    'id' => Html::getClass($field_config
      ->getName()),
    'data' => array(
      'label' => $field_config
        ->getLabel(),
      'field_name' => $field_config
        ->getName(),
      'field_type' => array(
        'data' => array(
          '#type' => 'link',
          '#title' => $this->fieldTypeManager
            ->getDefinitions()[$field_storage
            ->getType()]['label'],
          '#url' => Url::fromRoute("entity.field_config.{$this->targetEntityTypeId}_storage_edit_form", $route_parameters),
          '#options' => array(
            'attributes' => array(
              'title' => $this
                ->t('Edit field settings.'),
            ),
          ),
        ),
      ),
    ),
  );

  // Add the operations.
  $row['data'] = $row['data'] + parent::buildRow($field_config);
  if ($field_storage
    ->isLocked()) {
    $row['data']['operations'] = array(
      'data' => array(
        '#markup' => $this
          ->t('Locked'),
      ),
    );
    $row['class'][] = 'menu-disabled';
  }
  return $row;
}