diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module index 66bf54887f4e8075d994ff99eb6947d3e10a03f7..f05fd0281abb841c7f60b39b42256c8ba168ce78 100644 --- a/core/modules/entity_reference/entity_reference.module +++ b/core/modules/entity_reference/entity_reference.module @@ -191,10 +191,12 @@ function entity_reference_query_entity_reference_alter(AlterableInterface $query * @param array $selection_handler_settings * An array of settings supported by the selection handler specified above. * (e.g. 'target_bundles', 'sort', 'auto_create', etc). + * @param int $cardinality + * The cardinality of the field. * * @see \Drupal\entity_reference\Plugin\entity_reference\selection\SelectionBase::settingsForm() */ -function entity_reference_create_instance($entity_type, $bundle, $field_name, $field_label, $target_entity_type, $selection_handler = 'default', $selection_handler_settings = array()) { +function entity_reference_create_instance($entity_type, $bundle, $field_name, $field_label, $target_entity_type, $selection_handler = 'default', $selection_handler_settings = array(), $cardinality = 1) { // If a field type we know should exist isn't found, clear the field cache. if (!\Drupal::service('plugin.manager.field.field_type')->getDefinition('entity_reference')) { field_cache_clear(); @@ -209,6 +211,7 @@ function entity_reference_create_instance($entity_type, $bundle, $field_name, $f 'name' => $field_name, 'type' => 'entity_reference', 'entity_type' => $entity_type, + 'cardinality' => $cardinality, 'settings' => array( 'target_type' => $target_entity_type, ),