Skip to content

Commit

Permalink
Fix Client error using the "Add log" bulk action
Browse files Browse the repository at this point in the history
  • Loading branch information
mstenta committed Mar 27, 2024
1 parent 0156283 commit aa3cf82
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions modules/core/log/farm_log.module
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,11 @@ function farm_log_entity_prepare_form(EntityInterface $entity, $operation, FormS
$query = \Drupal::request()->query;

// Prepopulate the log asset field.
$asset_ids = $query->get('asset');
$asset_ids = $query->all('asset');
if (!empty($asset_ids)) {
/** @var \Drupal\Core\Field\EntityReferenceFieldItemList $asset_field */
$asset_field = $entity->get('asset');

// Wrap in an array, if necessary.
if (!is_array($asset_ids)) {
$asset_ids = [$asset_ids];
}

// Add each asset the user has view access to.
$assets = \Drupal::entityTypeManager()->getStorage('asset')->loadMultiple($asset_ids);
foreach ($assets as $asset) {
Expand Down

0 comments on commit aa3cf82

Please sign in to comment.