3 namespace Drupal\menu_ui;
5 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
6 use Drupal\Core\Entity\EntityInterface;
9 * Defines a class to build a listing of menu entities.
11 * @see \Drupal\system\Entity\Menu
12 * @see menu_entity_info()
14 class MenuListBuilder extends ConfigEntityListBuilder {
19 public function buildHeader() {
20 $header['title'] = t('Title');
21 $header['description'] = [
22 'data' => t('Description'),
23 'class' => [RESPONSIVE_PRIORITY_MEDIUM],
25 return $header + parent::buildHeader();
31 public function buildRow(EntityInterface $entity) {
33 'data' => $entity->label(),
34 'class' => ['menu-label'],
36 $row['description']['data'] = ['#markup' => $entity->getDescription()];
37 return $row + parent::buildRow($entity);
43 public function getDefaultOperations(EntityInterface $entity) {
44 $operations = parent::getDefaultOperations($entity);
46 if (isset($operations['edit'])) {
47 $operations['edit']['title'] = t('Edit menu');
48 $operations['add'] = [
49 'title' => t('Add link'),
51 'url' => $entity->urlInfo('add-link-form'),
54 if (isset($operations['delete'])) {
55 $operations['delete']['title'] = t('Delete menu');
63 public function render() {
64 $build = parent::render();
65 $build['#attached']['library'][] = "menu_ui/drupal.menu_ui.adminforms";