Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Core / Field / FieldTypePluginManager.php
index 905cdb4f1bb1281065a66343d55d187fd5960878..565fa4e6f74963ba98a7859025d02969e1f01f9b 100644 (file)
@@ -135,7 +135,7 @@ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePl
     // Add preconfigured definitions.
     foreach ($definitions as $id => $definition) {
       if (is_subclass_of($definition['class'], '\Drupal\Core\Field\PreconfiguredFieldUiOptionsInterface')) {
-        foreach ($definition['class']::getPreconfiguredOptions() as $key => $option) {
+        foreach ($this->getPreconfiguredOptions($definition['id']) as $key => $option) {
           $definitions['field_ui:' . $id . ':' . $key] = [
             'label' => $option['label'],
           ] + $definition;
@@ -150,6 +150,19 @@ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePl
     return $definitions;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getPreconfiguredOptions($field_type) {
+    $options = [];
+    $class = $this->getPluginClass($field_type);
+    if (is_subclass_of($class, '\Drupal\Core\Field\PreconfiguredFieldUiOptionsInterface')) {
+      $options = $class::getPreconfiguredOptions();
+      $this->moduleHandler->alter('field_ui_preconfigured_options', $options, $field_type);
+    }
+    return $options;
+  }
+
   /**
    * {@inheritdoc}
    */