Problem/Motivation
This is a followup from #1735118: Convert Field API to CMI and postponed on that issue.
+++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.phpundefined
@@ -0,0 +1,463 @@
+ /**
+ * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::__construct().
+ */
+++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.phpundefined
@@ -0,0 +1,423 @@
+ /**
+ * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::__construct().
+ */
+ public function __construct(array $values, $entity_type = 'field_instance') {I feel like we should document what we expect to have in the $values array here.
E.g., the exception handling for Field implies that the field type and field_name are required, that the the field_name needs to be a valid machine name.
For FieldInstance, they imply that entity_type, bundle, and one of field_name and field_uuid are required.
Per @swentel:
field_create_*(), field_update_*() document those.
Proposed resolution
Use the documentation from the field CRUD functions as a basis for docs describing the expected inputs for these constructors. An @see
reference does not make sense because #1953410: Remove field_create_*(), field_update_*() and field_delete_*() in favor of just using the ConfigEntity API will remove these functions.
Remaining tasks
- Review the existing documentation for
field_create_field()
,field_create_instance()
,field_update_field()
, andfield_update_instance()
. - Create a patch that adds similar documentation to the two class constructors' docblocks.
- Have field and documentation maintainers review the proposed docs for accuracy.