ProfileListBuilder.php in Linkit 8.5
File
src/ProfileListBuilder.php
View source
<?php
namespace Drupal\linkit;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
class ProfileListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['title'] = $this
->t('Profile');
$header['description'] = [
'data' => $this
->t('Description'),
'class' => [
RESPONSIVE_PRIORITY_MEDIUM,
],
];
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$linkitProfile = $entity;
$row['label'] = $linkitProfile
->label();
$row['description']['data'] = [
'#markup' => $linkitProfile
->getDescription(),
];
return $row + parent::buildRow($entity);
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['title'] = $this
->t('Edit profile');
}
$operations['matchers'] = [
'title' => $this
->t('Manage matchers'),
'weight' => 10,
'url' => Url::fromRoute('linkit.matchers', [
'linkit_profile' => $entity
->id(),
]),
];
return $operations;
}
}