Only display common fields on asset bundles that don't provide a map_popup view mode.
This commit is contained in:
parent
8df4b16772
commit
e7af56fe5f
|
@ -57,6 +57,15 @@ function farm_ui_map_asset_view(array &$build, EntityInterface $entity, EntityVi
|
|||
return $build;
|
||||
}
|
||||
|
||||
// The default view mode is used if a map_popup view mode is not provided.
|
||||
// Alter the default view mode to only include common fields.
|
||||
if ($display->getMode() === 'default') {
|
||||
$common_fields = ['flag', 'group', 'id_tag', 'location', 'notes', 'parent', 'status'];
|
||||
$build = array_filter($build, function ($key) use ($common_fields) {
|
||||
return strpos($key, '#') === 0 || in_array($key, $common_fields);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
// Build link to view logs referencing the asset.
|
||||
$url = Url::fromRoute('view.farm_log.page_asset', ['asset' => $entity->id(), 'log_type' => 'all']);
|
||||
$build['logs_links'] = [
|
||||
|
|
Loading…
Reference in New Issue