Skip to content

Commit 510b9d4

Browse files
MyvTsvstonebuzz
andauthored
fix(fields): massive actions with Fields plugin (#438)
* fix(fields): massive actions with Fields plugin * CHANGELOG.md * lint * fix phpsran --------- Co-authored-by: Stanislas <[email protected]>
1 parent 5f7ebd1 commit 510b9d4

File tree

5 files changed

+76
-4
lines changed

5 files changed

+76
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
- Fix massive actions compatibility with Fields plugin
11+
1012
## [2.14.14] - 2025-04-23
1113

1214
### Fixed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"php": ">=7.4"
44
},
55
"require-dev": {
6+
"glpi-project/phpstan-glpi": "^1.0",
67
"glpi-project/tools": "^0.7.5",
78
"php-parallel-lint/php-parallel-lint": "^1.4",
89
"phpstan/phpstan": "^2.1",

composer.lock

Lines changed: 50 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hook.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,26 @@ function plugin_genericobject_MassiveActions($type)
212212
return [];
213213
}
214214
}
215+
216+
function plugin_genericobject_MassiveActionsFieldsDisplay($options = [])
217+
{
218+
if (!Plugin::isPluginActive('fields')) {
219+
return false;
220+
}
221+
222+
if (!class_exists('PluginFieldsContainer') || !method_exists('PluginFieldsContainer', 'getEntries')) {
223+
return false;
224+
}
225+
226+
if (!class_exists('PluginFieldsField') || !method_exists('PluginFieldsField', 'showSingle')) {
227+
return false;
228+
}
229+
230+
$itemtypes = PluginFieldsContainer::getEntries('all');
231+
232+
if (in_array($options['itemtype'], $itemtypes)) {
233+
return PluginFieldsField::showSingle($options['itemtype'], $options['options'], true);
234+
}
235+
236+
return false;
237+
}

phpstan.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ parameters:
1515
- ../../src
1616
stubFiles:
1717
- ../../stubs/glpi_constants.php
18-
rules:
19-
- GlpiProject\Tools\PHPStan\Rules\GlobalVarTypeRule

0 commit comments

Comments
 (0)