OgMenuListBuilder.php in Organic Groups Menu (OG Menu) 8
File
src/OgMenuListBuilder.php
View source
<?php
namespace Drupal\og_menu;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class OgMenuListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('OG Menu');
$header['id'] = $this
->t('Machine name');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
return $row + parent::buildRow($entity);
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if ($entity
->access('view') && $entity
->hasLinkTemplate('overview-form')) {
$operations['view'] = array(
'title' => $this
->t('View'),
'weight' => 0,
'url' => $entity
->toUrl('overview-form'),
);
}
return $operations;
}
}