Add "Simple Add More" (SAM) Support [Drupal CMS]

Created on 13 August 2025, 6 days ago

Problem/Motivation

https://www.drupal.org/project/sam is part of Drupal CMS now.

Currently it does NOT support inline entity form, just the following widget types:

const SAM_ALLOWED_WIDGET_TYPES = [
  'email_default',
  'entity_reference_autocomplete',
  'link_attributes',
  'link_default',
  'linkit',
  'number',
  'path',
  'string_textarea',
  'string_textfield',
  'telephone',
  'telephone_default',
  'text_textarea',
  'text_textarea_with_summary',
  'text_textfield',
  'uri',
];

For contrib modules, the SAM module has a hook to declare compatibility:

/**
 * Allows modules to alter the list of supported widget types.
 *
 * Modules implementing this are responsible for ensuring that the way this
 * module shows/hides new elements works well with their widget.
 *
* @param array $widget_types
 *   An indexed array with supported widget machine names, to be modified by
 *   reference.

 */
function hook_sam_allowed_widget_types_alter(array &$widget_types) {
  $widget_types[] = 'my_custom_widget';
}

We should declare support für SAM to make it IEF work with SAM in Drupal CMS.

It already works fine beside one issue I found: Empty entities (IEF lines) are not sorted out. We'll have to fix this by checking that empty entities are never saved, but I guess that might even be unrelated.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024