Skip to content
Snippets Groups Projects

Resolve #3468220 "Improve field weights"

5 files
+ 45
17
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -138,6 +138,7 @@ class SchemaDotOrgFieldGroupEntityDisplayBuilder implements SchemaDotOrgFieldGro
}
$entity_type_id = $display->getTargetEntityTypeId();
$bundle = $display->getTargetBundle();
$display_type = ($display instanceof EntityFormDisplayInterface) ? 'form' : 'view';
$field_group = $this->getFieldGroup(
$entity_type_id,
@@ -152,6 +153,7 @@ class SchemaDotOrgFieldGroupEntityDisplayBuilder implements SchemaDotOrgFieldGro
$field_weight = $this->getFieldWeight(
$entity_type_id,
$bundle,
$field_name,
$schema_type,
$schema_property,
@@ -350,6 +352,8 @@ class SchemaDotOrgFieldGroupEntityDisplayBuilder implements SchemaDotOrgFieldGro
*
* @param string $entity_type_id
* The ID of the entity type.
* @param string $bundle
* The bundle.
* @param string $field_name
* The name of the field.
* @param string $schema_type
@@ -362,7 +366,7 @@ class SchemaDotOrgFieldGroupEntityDisplayBuilder implements SchemaDotOrgFieldGro
* @return int
* The weight of the field in the field group.
*/
protected function getFieldWeight(string $entity_type_id, string $field_name, string $schema_type, string $schema_property, array $field_defaults): int {
protected function getFieldWeight(string $entity_type_id, string $bundle, string $field_name, string $schema_type, string $schema_property, array $field_defaults): int {
$field_weight = $field_defaults['group_field_weight'] ?? NULL;
if ($field_weight) {
return $field_weight;
@@ -386,7 +390,7 @@ class SchemaDotOrgFieldGroupEntityDisplayBuilder implements SchemaDotOrgFieldGro
}
}
return $this->schemaEntityDisplayBuilder->getSchemaPropertyDefaultFieldWeight($entity_type_id, $field_name, $schema_property);
return $this->schemaEntityDisplayBuilder->getSchemaPropertyDefaultFieldWeight($entity_type_id, $bundle, $field_name, $schema_type, $schema_property);
}
/**
Loading