Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / module / content-entity / src / ExampleViewBuilder.php.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/module/content-entity/src/ExampleViewBuilder.php.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/module/content-entity/src/ExampleViewBuilder.php.twig
new file mode 100644 (file)
index 0000000..389abfb
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace Drupal\{{ machine_name }};
+
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityViewBuilder;
+
+/**
+ * Provides a view controller for {{ entity_type_label|article|lower }} entity type.
+ */
+class {{ class_prefix }}ViewBuilder extends EntityViewBuilder {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
+    $build = parent::getBuildDefaults($entity, $view_mode);
+    // The {{ entity_type_label|lower }} has no entity template itself.
+    unset($build['#theme']);
+    return $build;
+  }
+
+}