Version 1
[yaffs-website] / web / core / modules / responsive_image / src / ResponsiveImageStyleListBuilder.php
diff --git a/web/core/modules/responsive_image/src/ResponsiveImageStyleListBuilder.php b/web/core/modules/responsive_image/src/ResponsiveImageStyleListBuilder.php
new file mode 100644 (file)
index 0000000..1b4ded0
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+namespace Drupal\responsive_image;
+
+use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
+use Drupal\Core\Entity\EntityInterface;
+
+/**
+ * Provides a listing of responsive image styles.
+ */
+class ResponsiveImageStyleListBuilder extends ConfigEntityListBuilder {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildHeader() {
+    $header['label'] = t('Label');
+    $header['id'] = t('Machine name');
+    return $header + parent::buildHeader();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildRow(EntityInterface $entity) {
+    $row['label'] = $entity->label();
+    $row['id'] = $entity->id();
+    return $row + parent::buildRow($entity);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDefaultOperations(EntityInterface $entity) {
+    $operations = parent::getDefaultOperations($entity);
+    $operations['duplicate'] = [
+      'title' => t('Duplicate'),
+      'weight' => 15,
+      'url' => $entity->urlInfo('duplicate-form'),
+    ];
+    return $operations;
+  }
+
+}