22
33namespace Drupal\commerce;
44
5+ use Drupal\entity\BundleFieldDefinition;
6+
57/**
68 * Manages configurable fields based on field definitions.
79 *
@@ -12,7 +14,7 @@ interface ConfigurableFieldManagerInterface {
1214 /**
1315 * Creates a configurable field from the given field definition.
1416 *
15- * @param \Drupal\commerce \BundleFieldDefinition $field_definition
17+ * @param \Drupal\entity \BundleFieldDefinition $field_definition
1618 * The field definition.
1719 * @param bool $lock
1820 * Whether the created field should be locked.
@@ -25,10 +27,31 @@ interface ConfigurableFieldManagerInterface {
2527 */
2628 public function createField(BundleFieldDefinition $field_definition, $lock = TRUE);
2729
30+ /**
31+ * Configure display modes for the given field definition.
32+ *
33+ * @param string $field_name
34+ * The field name.
35+ * @param string $entity_type_id
36+ * The entity type ID.
37+ * @param string $bundle
38+ * The bundle.
39+ * @param array $modes
40+ * The display mode configuration, keyed by display type, then mode.
41+ * Display type is one of 'form' or 'view', with their values being arrays
42+ * keyed by display mode ID. The display modes are created if they do not
43+ * already exist.
44+ *
45+ * @throws \InvalidArgumentException
46+ * Thrown when given an incomplete field definition (missing name,
47+ * target entity type ID, or target bundle).
48+ */
49+ public function configureFieldDisplayModes($field_name, $entity_type_id, $bundle, $modes);
50+
2851 /**
2952 * Deletes the configurable field created from the given field definition.
3053 *
31- * @param \Drupal\commerce \BundleFieldDefinition $field_definition
54+ * @param \Drupal\entity \BundleFieldDefinition $field_definition
3255 * The field definition.
3356 *
3457 * @throws \InvalidArgumentException
@@ -42,7 +65,7 @@ public function deleteField(BundleFieldDefinition $field_definition);
4265 /**
4366 * Checks whether the configurable field has data.
4467 *
45- * @param \Drupal\commerce \BundleFieldDefinition $field_definition
68+ * @param \Drupal\entity \BundleFieldDefinition $field_definition
4669 * The field definition.
4770 *
4871 * @return bool
0 commit comments