Version 1
[yaffs-website] / web / modules / contrib / devel / tests / modules / devel_entity_test / devel_entity_test.module
diff --git a/web/modules/contrib/devel/tests/modules/devel_entity_test/devel_entity_test.module b/web/modules/contrib/devel/tests/modules/devel_entity_test/devel_entity_test.module
new file mode 100644 (file)
index 0000000..4be887b
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * @file
+ * Test module for the entity API providing several entity types for testing.
+ */
+
+/**
+ * Implements hook_entity_view_mode_info_alter().
+ */
+function devel_entity_test_entity_view_mode_info_alter(&$view_modes) {
+  $entity_info = \Drupal::entityTypeManager()->getDefinitions();
+  foreach ($entity_info as $entity_type => $info) {
+    if ($entity_info[$entity_type]->getProvider() == 'devel_entity_test_canonical' && !isset($view_modes[$entity_type])) {
+      $view_modes[$entity_type] = array(
+        'full' => array(
+          'label' => t('Full object'),
+          'status' => TRUE,
+          'cache' => TRUE,
+        ),
+        'teaser' => array(
+          'label' => t('Teaser'),
+          'status' => TRUE,
+          'cache' => TRUE,
+        ),
+      );
+    }
+  }
+}