public function DomainListBuilder::buildRow in Domain Access 8
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 DraggableListBuilder::buildRow
See also
\Drupal\Core\Entity\EntityListBuilder::render()
File
- domain/
src/ DomainListBuilder.php, line 221
Class
- DomainListBuilder
- User interface for the domain overview screen.
Namespace
Drupal\domainCode
public function buildRow(EntityInterface $entity) {
// If the user cannot view the domain, none of these actions are permitted.
$admin = $this->accessHandler
->checkAccess($entity, 'view');
if ($admin
->isForbidden()) {
return;
}
$row['label'] = $entity
->label();
$row['hostname'] = [
'#markup' => $entity
->getLink(),
];
if ($entity
->isActive()) {
$row['hostname']['#prefix'] = '<strong>';
$row['hostname']['#suffix'] = '</strong>';
}
$row['status'] = [
'#markup' => $entity
->status() ? $this
->t('Active') : $this
->t('Inactive'),
];
$row['is_default'] = [
'#markup' => $entity
->isDefault() ? $this
->t('Yes') : $this
->t('No'),
];
$row['scheme'] = [
'#markup' => $entity
->getRawScheme(),
];
$row += parent::buildRow($entity);
if ($entity
->getRawScheme() === 'variable') {
$row['scheme']['#markup'] .= ' (' . $entity
->getScheme(FALSE) . ')';
}
if (!$this->currentUser
->hasPermission('administer domains')) {
unset($row['weight']);
}
return $row;
}