Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / language_fallback_candidates_OPERATION_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/language_fallback_candidates_OPERATION_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/language_fallback_candidates_OPERATION_alter.twig
new file mode 100644 (file)
index 0000000..b79e374
--- /dev/null
@@ -0,0 +1,10 @@
+/**
+ * Implements hook_language_fallback_candidates_OPERATION_alter().
+ */
+function {{ machine_name }}_language_fallback_candidates_OPERATION_alter(array &$candidates, array $context) {
+  // We know that the current OPERATION deals with entities so no need to check
+  // here.
+  if ($context['data']->getEntityTypeId() == 'node') {
+    $candidates = array_reverse($candidates);
+  }
+}