mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Add tabs for each log type.
This commit is contained in:
parent
975ac415d5
commit
6856438e71
|
@ -5,3 +5,11 @@ farm.asset.logs:
|
|||
log_type: 'all'
|
||||
base_route: entity.asset.canonical
|
||||
weight: 50
|
||||
farm.asset.logs.all:
|
||||
title: 'All'
|
||||
route_name: view.farm_log.page_asset
|
||||
route_parameters:
|
||||
log_type: 'all'
|
||||
parent_id: farm.asset.logs
|
||||
farm.asset.logs.type:
|
||||
deriver: Drupal\farm_ui_views\Plugin\Derivative\FarmLogViewsTaskLink
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_ui_views\Plugin\Derivative;
|
||||
|
||||
use Drupal\Component\Plugin\Derivative\DeriverBase;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
||||
/**
|
||||
* Provides task links for farmOS Logs Views.
|
||||
*/
|
||||
class FarmLogViewsTaskLink extends DeriverBase {
|
||||
|
||||
use StringTranslationTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDerivativeDefinitions($base_plugin_definition) {
|
||||
$links = [];
|
||||
|
||||
// Add links for each bundle.
|
||||
$bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo('log');
|
||||
foreach ($bundles as $type => $info) {
|
||||
$links['farm.asset.logs.' . $type] = [
|
||||
'title' => $info['label'],
|
||||
'parent_id' => 'farm.asset.logs',
|
||||
'route_name' => 'view.farm_log.page_asset',
|
||||
'route_parameters' => [
|
||||
'log_type' => $type,
|
||||
],
|
||||
] + $base_plugin_definition;
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue