PHP Fatal error: Cannot redeclare Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant::id()

Created on 4 July 2024, 6 months ago
Updated 5 July 2024, 6 months ago

Every time composer updates, website errors out with the following:

PHP Fatal error: Cannot redeclare Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant::id() in C:\[...]\modules\contrib\panels\src\Plugin\DisplayVariant\PanelsDisplayVariant.php on line 582

At the bottom of said file, this function appears twice:

public function id() {
    // Explicit IPE/Panelizer Support.
    if (!empty($this->getContexts()['@panelizer.entity_context:entity']) && $this->getContexts()['@panelizer.entity_context:entity']->hasContextValue()) {
      return $this->getContexts()['@panelizer.entity_context:entity']->getContextValue()->uuid();
    }
    // If the panelizer context isn't available, just return our uuid.
    return parent::id();
  }

  public function id() {
    // Explicit IPE/Panelizer Support.
    if (!empty($this->getContexts()['@panelizer.entity_context:entity']) && $this->getContexts()['@panelizer.entity_context:entity']->hasContextValue()) {
      return $this->getContexts()['@panelizer.entity_context:entity']->getContextValue()->uuid();
    }
    // If the panelizer context isn't available, just return our uuid.
    return parent::id();
  }

I have to manually comment out the second declaration every time, which fixes the error until the next update, then it comes back.

🐛 Bug report
Status

Active

Version

4.8

Component

Code

Created by

🇨🇦Canada sharchun

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024