- π΅π·Puerto Rico rubenvarela
This is still an issue on latest version. Can recreate when using devel generate.
Patch still works, just on line 477 on 8.x-1.12
If a paragraph includes an ERR field that allows all paragraph types by selecting the "Include the selected below" radio button and not checking any of the paragraph types, and you use layout builder on the parent entity, attempting to manage layout results in an EntityStorageException. Just prior to this, watchdog logs a php warning: array_rand(): Array is empty in Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem::generateSampleValue() (line 496 of .../entity_reference_revisions/src/Plugin/Field/FieldType/EntityReferenceRevisionsItem.php)
The entire issue can be worked around by checking all the bundle types.
Create an entity (Node, e.g.; my use case was a Group) with an ERR field referencing a specific paragraph bundle.
Give that paragraph bundle an ERR that can reference all Paragraph types:
Use layout builder to manage the entity display
The following code snippet from \Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem:generateSampleValue()
needs to modified to properly handle the situation where $handler_settings['target_bundles']
is empty, and come back with an array of all bundles
// Determine referenceable bundles.
$bundle_manager = \Drupal::service('entity_type.bundle.info');
if (isset($handler_settings['target_bundles']) && is_array($handler_settings['target_bundles'])) {
if (empty($handler_settings['negate'])) {
$bundles = $handler_settings['target_bundles'];
}
else {
$bundles = array_filter($bundle_manager->getBundleInfo($target_type_id), function ($bundle) use ($handler_settings) {
return !in_array($bundle, $handler_settings['target_bundles'], TRUE);
});
}
}
else {
$bundles = $bundle_manager->getBundleInfo($target_type_id);
}
$bundle = array_rand($bundles);
Active
1.9
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
This is still an issue on latest version. Can recreate when using devel generate.
Patch still works, just on line 477 on 8.x-1.12