Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / options_list_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/options_list_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/options_list_alter.twig
new file mode 100644 (file)
index 0000000..ae68645
--- /dev/null
@@ -0,0 +1,10 @@
+/**
+ * Implements hook_options_list_alter().
+ */
+function {{ machine_name }}_options_list_alter(array &$options, array $context) {
+  // Check if this is the field we want to change.
+  if ($context['fieldDefinition']->id() == 'field_option') {
+    // Change the label of the empty option.
+    $options['_none'] = t('== Empty ==');
+  }
+}