But even if we fix all those and make getLink() correctly return an empty link, the pager overall and its 'All' link still shows.
And I don't think there's a way to stop that from showing with the API access we have from the style plugin.
I think to fix this properly, we need:
- a custom Views display plugin for EntityPagerBlock
- a block plugin and deriver (because sadly we can't use Drupal\views\Plugin\Derivative\ViewsBlock with a different Views display plugin)
This would not add any admin setup, since we can make our display plugin force the style (same was RSS display plugin works)
What it would mean is that our block plugin can check for a viable entity before the view is even executed -- so for example, in the block for a node pager view, if we are not on a node, we return an empty block and don't execute the view.
Comments
Comment #2
joachim commentedCause by:
$this->getCurrentRow() gets a FALSE if we can't find an entity. But then the addition casts it to 0.
Comment #3
joachim commentedI think there's more to fix than this actually, and multiple issues that I've already filed, such as #3594036: current entity detection gets a false positive for matching ID of other entities.
But even if we fix all those and make getLink() correctly return an empty link, the pager overall and its 'All' link still shows.
And I don't think there's a way to stop that from showing with the API access we have from the style plugin.
I think to fix this properly, we need:
- a custom Views display plugin for EntityPagerBlock
- a block plugin and deriver (because sadly we can't use Drupal\views\Plugin\Derivative\ViewsBlock with a different Views display plugin)
This would not add any admin setup, since we can make our display plugin force the style (same was RSS display plugin works)
What it would mean is that our block plugin can check for a viable entity before the view is even executed -- so for example, in the block for a node pager view, if we are not on a node, we return an empty block and don't execute the view.
Comment #4
joachim commentedComment #5
joachim commentedFor the deeper problem: #3616326: entity pager shows (in disabled state) when not on an entity that's in the pager's list.
Comment #7
joachim commented