Wrong #format key for export_icon theme cause errors

Created on 16 August 2023, 10 months ago
Updated 6 December 2023, 7 months ago

Problem/Motivation

The attach to icon causes the following php deprecation message:

Deprecated function: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Html::escape()

Steps to reproduce

Add a attach to to a views display and render this display.

Proposed resolution

I might get something wrong about the module but I think the render array for the export_icon contains the property #type instead of the #format which is specified by views data export module: https://git.drupalcode.org/project/views_data_export/-/blob/8.x-1.x/view....

πŸ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany Harlor Berlin

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

Comments & Activities

  • Issue created by @Harlor
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    1 pass, 2 fail
  • @harlor opened merge request.
  • Status changed to Needs review 10 months ago
  • πŸ‡©πŸ‡ͺGermany Harlor Berlin
  • Status changed to RTBC 10 months ago
  • This change is correct. It should be #format.

    views_data_export/src/Plugin/views/style/DataExport::attachTo() has this code:

        // Add the icon to the view.
        $format = $this->displayHandler->getContentType();
        $this->view->feedIcons[] = [
          '#theme' => 'export_icon',
          '#url' => $url,
          '#format' => mb_strtoupper($format),
          '#theme_wrappers' => [
            'container' => [
              '#attributes' => [
                'class' => [
                  Html::cleanCssIdentifier($format) . '-feed',
                  'views-data-export-feed',
                ],
              ],
            ],
          ],
        ];
    
  • πŸ‡«πŸ‡·France opi

    Patch is working. Update title. Still RTBC !

Production build 0.69.0 2024