Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

joachim created an issue. See original summary.

joachim’s picture

Cause by:

  protected function getLink($name, $offset = 0) {
    $row = $this->getResultRow($this->getCurrentRow() + $offset);

$this->getCurrentRow() gets a FALSE if we can't find an entity. But then the addition casts it to 0.

joachim’s picture

I 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.

joachim’s picture

Title: pager still shows when getEntity() doesn't get an entity » pager still shows when getEntity() doesn't get an entity - FALSE return from getCurrentRow() is incorrectly cast to int

  • joachim committed 6a6a19f7 on 2.0.x
    fix: #3594037 pager still shows when getEntity() doesn't get an entity...
joachim’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.