ResponsiveImageStyleListBuilder.php 1.07 KB
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Contains \Drupal\responsive_image\ResponsiveImageStyleListBuilder.
6 7
 */

8
namespace Drupal\responsive_image;
9

10
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
11 12 13
use Drupal\Core\Entity\EntityInterface;

/**
14
 * Provides a listing of responsive image styles.
15
 */
16
class ResponsiveImageStyleListBuilder extends ConfigEntityListBuilder {
17 18

  /**
19
   * {@inheritdoc}
20
   */
21 22 23 24 25
  public function buildHeader() {
    $header['label'] = t('Label');
    $header['id'] = t('Machine name');
    return $header + parent::buildHeader();
  }
26

27 28 29 30 31 32 33
  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $this->getLabel($entity);
    $row['id'] = $entity->id();
    return $row + parent::buildRow($entity);
34 35 36
  }

  /**
37
   * {@inheritdoc}
38
   */
39 40
  public function getDefaultOperations(EntityInterface $entity) {
    $operations = parent::getDefaultOperations($entity);
41 42 43
    $operations['duplicate'] = array(
      'title' => t('Duplicate'),
      'weight' => 15,
44 45
      'url' => $entity->urlInfo('duplicate-form'),
    );
46 47 48 49
    return $operations;
  }

}