Just like the default glossary, but implement to taxonomy terms instead of nodes.

Bug:

Fatal error: Unsupported operand types in R:\web\app\drupal\Develop-8.x\drupal-8.0.x\core\modules\views\src\ManyToOneHelper.php on line 307

The Problem:

        $placeholders = array(
          $placeholder => $value,
        ) + $this->placeholers;

$this->placeholders here is NULL.

Simple solution

        $placeholders = array(
          $placeholder => $value,
        );
        if (!empty($this->placeholders)) {
          $placeholder += $this->placeholders;
        }

while I don't have time to learn Views deep enough to know if all the callers that call this class object would provide value for that property("placeholders"), I don't see any default assignment before this in the file.

This should solve this issue for now and without any functionality change.
For further context-wise solution, may require Views-experts' assistance.

Comments

kolier created an issue. See original summary.

dawehner’s picture

Issue tags: +Needs tests

Thank you for the report!

At that point $this->placeholders is completly empty so I'm wondering whether we need this + ... at all.

DanGun’s picture

Jiha, this solution worked very well for my needs. Is there a chance to get this solution into core?

arunkumark’s picture

Status: Active » Needs review
StatusFileSize
new636 bytes

Hi,
I have patched for Above issue as suggested solutions.
Also this issue exist in core 8.1.x

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

sjovanig’s picture

Patch is working. Thanks.

arunkumark’s picture

Priority: Normal » Major
StatusFileSize
new636 bytes

Hi,
patch re-rolled for supporting Druapl 8.1.x version

cilefen’s picture

Issue tags: -views

How did this become Major suddenly? Perhaps it is Major, but there was no explanation given.

Status: Needs review » Needs work

The last submitted patch, 7: views_taxonomy_glossary_2630692_7.patch, failed testing.

cilefen’s picture

A fatal affecting certain situations is Major.

banacan’s picture

So is the latest patch for 8.1.x working or not?

matthias_bauw’s picture

This bug still exists in 8.1.6. Tried it on a vanilla install on simplytest.me

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lendude’s picture

Status: Needs work » Needs review
Issue tags: -glossary, -Needs tests
StatusFileSize
new7.54 KB
new7.02 KB

Moving the work over from #2778411: Glossary mode is not working for taxonomy in views contextual filter and closing that as a duplicate.

Fix and a test. Approach os a little different for the fix. Instead of testing for this->placeholders we just throw it out, it's not used anywhere in the entire project.

Talked to @dawehner on IRC about moving the test to dedicated many-to-one tests, except we don't have any. So leaving this as a separate test for now.

The last submitted patch, 14: taxonomy_glossary-2778411-11-TEST_ONLY.patch, failed testing.

jhedstrom’s picture

This looks good. The test properly demonstrates the current fatal error.

A few tiny nits (they could potentially be fixed on commit).

  1. +++ b/core/modules/views/src/Tests/TaxonomyGlossaryTest.php
    @@ -0,0 +1,63 @@
    +  public static $modules = ['taxonomy'];
    ...
    +  public static $testViews = ['test_taxonomy_glossary'];
    

    Could these use {@inheritdoc} instead?

  2. +++ b/core/modules/views/src/Tests/TaxonomyGlossaryTest.php
    @@ -0,0 +1,63 @@
    +  protected function setUp() {
    +    parent::setUp();
    

    This needs the {@inheritdoc} docblock.

lendude’s picture

StatusFileSize
new708 bytes
new7.51 KB

@jhedstrom thanks for the review!

1. Both @inheritdoc and the copy/paste string occur in core, no real consensus i guess. I like the inheritdoc here, it clearly indicates nothing special is happening.
2. Added.

dawehner’s picture

Thank you

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

.

alexpott’s picture

Title: Fatal error when I on my way to create taxonomy term glossary » Fatal error when creating taxonomy term glossary view
Status: Reviewed & tested by the community » Patch (to be ported)

Committed 33280fd and pushed to 8.3.x. Thanks!

Setting to 'patch to be ported' for cherry-pick to 8.2.x once 8.2.0 is released.

I considered the BC implications of this tiny behaviour change on commit but the property is not documented or used anywhere but here and I don't think the ManyToOneHelper is an extension point.

diff --git a/core/modules/views/src/Tests/TaxonomyGlossaryTest.php b/core/modules/views/src/Tests/TaxonomyGlossaryTest.php
index 76443cc..ccda887 100644
--- a/core/modules/views/src/Tests/TaxonomyGlossaryTest.php
+++ b/core/modules/views/src/Tests/TaxonomyGlossaryTest.php
@@ -2,12 +2,7 @@
 
 namespace Drupal\views\Tests;
 
-use Drupal\Component\Utility\Unicode;
-use Drupal\Core\Language\LanguageInterface;
-use Drupal\Core\Url;
-use Drupal\taxonomy\Entity\Vocabulary;
 use Drupal\taxonomy\Tests\TaxonomyTestTrait;
-use Drupal\views\Views;
 
 /**
  * Tests glossary functionality of taxonomy views.

Fixed on commit.

  • alexpott committed 33280fd on 8.3.x
    Issue #2630692 by Lendude, arunkumark: Fatal error when creating...
ressa’s picture

I was going to ask how to apply the patch in #2630692: Fatal error when creating taxonomy term glossary view to Drupal 8.2-RC2, since it is not included in that version.
I have now done some testing, and to answer my own question, if anyone else has this issue, one way is to define Drupal core version and the patch in a make-file like this:

# Drupal core version
core: '8.x'

# Drush Make API version
api: 2

# Core project
projects:
  drupal:
    patch:
      - "https://www.drupal.org/files/issues/taxonomy_glossary-2630692-17.patch"
...

  • alexpott committed 103a18d on 8.2.x
    Issue #2630692 by Lendude, arunkumark: Fatal error when creating...
alexpott’s picture

Status: Patch (to be ported) » Fixed

Committed 103a18d and pushed to 8.2.x. Thanks!

ressa’s picture

Awesome, thank you so much @alexpott!

Status: Fixed » Closed (fixed)

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

xjm’s picture

Correcting issue credit.

xjm’s picture