Skip to content
Snippets Groups Projects
Commit 4265125e authored by Eleo Basili's avatar Eleo Basili
Browse files

Issue #3419382 by ankitdebnath, Mingsong, Anybody, eleonel: Drupal 10.2.x compatibility

parent fcfac856
No related branches found
No related tags found
No related merge requests found
......@@ -13,17 +13,16 @@ use Drupal\entity_reference_display\Plugin\Field\FieldFormatter\EntityReferenceR
* Implements hook_form_alter().
*/
function entity_reference_display_form_alter(&$form, FormStateInterface $form_state, $form_id) {
/** @var \Drupal\field\Entity\FieldConfig $field_config */
$field_config = $form_state->getStorage()['field_config'];
if ($field_config->getType() !== 'entity_reference_display') {
// Exit early if not the correct field type.
return;
}
switch ($form_id) {
case 'field_storage_config_edit_form':
// Disable editing and remove states for the cardinality settings.
_disable_cardinality_settings($form['cardinality_container']);
/** @var \Drupal\field\Entity\FieldConfig $field_config */
$field_config = $form_state->getStorage()['field_config'];
// Only for display mode field.
if ($field_config->getType() == 'entity_reference_display') {
// Disable editing and remove states for the cardinality settings.
_disable_cardinality_settings($form['cardinality_container']);
}
break;
case 'field_config_edit_form':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment