ShortcutSetListBuilder.php

Same filename in other branches
  1. 9 core/modules/shortcut/src/ShortcutSetListBuilder.php
  2. 10 core/modules/shortcut/src/ShortcutSetListBuilder.php
  3. 11.x core/modules/shortcut/src/ShortcutSetListBuilder.php

Namespace

Drupal\shortcut

File

core/modules/shortcut/src/ShortcutSetListBuilder.php

View source
<?php

namespace Drupal\shortcut;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Defines a class to build a listing of shortcut set entities.
 *
 * @see \Drupal\shortcut\Entity\ShortcutSet
 */
class ShortcutSetListBuilder extends ConfigEntityListBuilder {
    
    /**
     * {@inheritdoc}
     */
    public function buildHeader() {
        $header['name'] = t('Name');
        return $header + parent::buildHeader();
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDefaultOperations(EntityInterface $entity) {
        $operations = parent::getDefaultOperations($entity);
        if (isset($operations['edit'])) {
            $operations['edit']['title'] = t('Edit shortcut set');
        }
        $operations['list'] = [
            'title' => t('List links'),
            'url' => $entity->toUrl('customize-form'),
        ];
        return $operations;
    }
    
    /**
     * {@inheritdoc}
     */
    public function buildRow(EntityInterface $entity) {
        $row['name'] = $entity->label();
        return $row + parent::buildRow($entity);
    }

}

Classes

Title Deprecated Summary
ShortcutSetListBuilder Defines a class to build a listing of shortcut set entities.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.