9b4a985fb415aa209465de5ee50b3616f28f091b
[yaffs-website] / web / modules / contrib / paragraphs / src / Controller / ParagraphsTypeListBuilder.php
1 <?php
2
3 namespace Drupal\paragraphs\Controller;
4
5 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
6 use Drupal\Core\Entity\EntityInterface;
7
8 /**
9  * Provides a listing of ParagraphsType.
10  */
11 class ParagraphsTypeListBuilder extends ConfigEntityListBuilder {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function buildHeader() {
17     $header['label'] = $this->t('Paragraphs types');
18     $header['id'] = $this->t('Machine name');
19     return $header + parent::buildHeader();
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function buildRow(EntityInterface $entity) {
26     $row['label'] = $entity->label();
27     $row['id'] = $entity->id();
28     // You probably want a few more properties here...
29     return $row + parent::buildRow($entity);
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   public function getDefaultOperations(EntityInterface $entity) {
36     /** @var \Drupal\field\FieldConfigInterface $entity */
37     $operations = parent::getDefaultOperations($entity);
38
39     if (isset($operations['edit'])) {
40       $operations['edit']['weight'] = 30;
41     }
42
43     return $operations;
44   }
45
46 }