There is a way - it's actually quite easy but you need to dig deep into Craft 3 to do it. In general: there is only one single Javascript function that fetches all elements for all index pages
updateElements: function() {
// Ignore if we're not fully initialized yet
if (!this.initialized) {
return;
}
this.setIndexBusy();
var params = this.getViewParams();
Craft.postActionRequest(this.settings.updateElementsAction, params, $.proxy(function(response, textStatus) {
this.setIndexAvailable();
if (textStatus === 'success') {
this._updateView(params, response);
}
else {
Craft.cp.displayError(Craft.t('app', 'An unknown error occurred.'));
}
}, this));
},
As you can see: the route is a variable in the defaults
updateElementsAction: 'element-indexes/get-elements'
In order to change this route you'll have to overwrite it in a JS file
Craft.BaseElementIndex.defaults.updateElementsAction = 'your-awesome-plugin-route';
Not let's take a look at the controller: After certain other functions the final call that searches for all elements is the following ElementIndexController line 379
$responseData['html'] = $elementType::indexHtml(
$this->_elementQuery, // <-- this is the important part
$disabledElementIds,
$this->_viewState,
$this->_sourceKey,
$this->_context,
$includeContainer,
$showCheckboxes
);
All you have to do is to extend this Controller, build a custom one, link the route to your custom controller and change the $this->_elementQuery
. You can include your custom search parameters, include hidden content fields, create custom relation fields for groups and search for elements related to this user group or whatever you want.
It seems a little bit tricky at first but it's actually pretty easy. I've done it several times