Prepopulate the asset field when creating a log from the asset page.

This commit is contained in:
paul121 2020-12-09 11:00:37 -08:00 committed by Michael Stenta
parent 85f3f1ad79
commit 7cdc0eb67b
1 changed files with 6 additions and 0 deletions

View File

@ -21,10 +21,16 @@ class FarmAssetAddLogActionLink extends DeriverBase {
$links['farm.asset.add_log.' . $type] = [
'title' => 'Add ' . $info['label'],
'route_name' => 'entity.log.add_form',
'class' => '\Drupal\farm_ui_menu\Plugin\Menu\LocalAction\FarmAddLogPrepopulate',
'appears_on' => [
'entity.asset.canonical',
],
'route_parameters' => ['log_type' => $type],
'prepopulate' => [
'asset' => [
'route_parameter' => 'asset',
],
],
] + $base_plugin_definition;
}