Skip to content

Commit

Permalink
Fix Client error using the "Add log" bulk action #814
Browse files Browse the repository at this point in the history
  • Loading branch information
mstenta committed Mar 27, 2024
1 parent a4e13c9 commit 6b14348
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [Set plant_type fields form/view display settings via alter hook instead of config #806](https://github.com/farmOS/farmOS/pull/806)

### Fixed

- [Fix Client error using the "Add log" bulk action #814](https://github.com/farmOS/farmOS/pull/814)

## [3.1.2] 2024-02-26

### Fixed
Expand Down
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 6b14348

Please sign in to comment.