2
2
3
3
namespace Drupal \commerce ;
4
4
5
+ use Drupal \Core \Field \FieldDefinitionInterface ;
6
+ use Drupal \entity \BundleFieldDefinition ;
7
+
5
8
/**
6
9
* Manages configurable fields based on field definitions.
7
10
*
@@ -12,7 +15,7 @@ interface ConfigurableFieldManagerInterface {
12
15
/**
13
16
* Creates a configurable field from the given field definition.
14
17
*
15
- * @param \Drupal\commerce \BundleFieldDefinition $field_definition
18
+ * @param \Drupal\entity \BundleFieldDefinition $field_definition
16
19
* The field definition.
17
20
* @param bool $lock
18
21
* Whether the created field should be locked.
@@ -25,10 +28,31 @@ interface ConfigurableFieldManagerInterface {
25
28
*/
26
29
public function createField (BundleFieldDefinition $ field_definition , $ lock = TRUE );
27
30
31
+ /**
32
+ * Configure display modes for the given field definition.
33
+ *
34
+ * @param string $field_name
35
+ * The field name.
36
+ * @param string $entity_type_id
37
+ * The entity type ID.
38
+ * @param string $bundle
39
+ * The bundle.
40
+ * @param array $modes
41
+ * The display mode configuration, keyed by display type, then mode.
42
+ * Display type is one of 'form' or 'view', with their values being arrays
43
+ * keyed by display mode ID. The display modes are created if they do not
44
+ * already exist.
45
+ *
46
+ * @throws \InvalidArgumentException
47
+ * Thrown when given an incomplete field definition (missing name,
48
+ * target entity type ID, or target bundle).
49
+ */
50
+ public function configureFieldDisplayModes ($ field_name , $ entity_type_id , $ bundle , $ modes );
51
+
28
52
/**
29
53
* Deletes the configurable field created from the given field definition.
30
54
*
31
- * @param \Drupal\commerce \BundleFieldDefinition $field_definition
55
+ * @param \Drupal\entity \BundleFieldDefinition $field_definition
32
56
* The field definition.
33
57
*
34
58
* @throws \InvalidArgumentException
@@ -42,7 +66,7 @@ public function deleteField(BundleFieldDefinition $field_definition);
42
66
/**
43
67
* Checks whether the configurable field has data.
44
68
*
45
- * @param \Drupal\commerce \BundleFieldDefinition $field_definition
69
+ * @param \Drupal\entity \BundleFieldDefinition $field_definition
46
70
* The field definition.
47
71
*
48
72
* @return bool
0 commit comments