Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / field_info_max_weight.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_max_weight.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_max_weight.twig
new file mode 100644 (file)
index 0000000..e0579b9
--- /dev/null
@@ -0,0 +1,12 @@
+/**
+ * Implements hook_field_info_max_weight().
+ */
+function {{ machine_name }}_field_info_max_weight($entity_type, $bundle, $context) {
+  $weights = array();
+
+  foreach (my_module_entity_additions($entity_type, $bundle, $context) as $addition) {
+    $weights[] = $addition['weight'];
+  }
+
+  return $weights ? max($weights) : NULL;
+}