Problem/Motivation

The Rss view style plugin sets some namespaces and its channel elements in a class property but never defines it. As these properties are accessed from the outside in template_preprocess_views_view_rss() those should be defined as public properties.

Steps to reproduce

  • Check Drupal\views\Plugin\views\style\Rss::render() method's code in core/modules/views/src/Plugin/views/style/RssExtended.php to see that $this->namespaces and $this->channel_elements are assigned some values without ever defining them

Proposed resolution

  • Define both mentioned properties as public class properties
  • See if Rss::channel_items has to be rewritten in camel-case format to Rss::channelElements to fulfill code style rules. If so, there has to be a fallback mechanism (e.g. via magic __get() method to still allow (but deprecate) usage of Rss::channel_elements. Another option is to provide getter methods for these properties, but this may result in even more backwards compatibility issues.

Remaining tasks

  • Create an issue fork or a patch to fix this issue

User interface changes

n/a

API changes

  • If Rss::channel_elements is rewritten to camel-case format there may a deprecation for its old notation

Data model changes

n/a

Release notes snippet

Fix usage of undefined properties in Rss views style plugin

Comments

hctom created an issue. See original summary.

hctom’s picture

Issue summary: View changes

Update: I just found out that both properties are accessed from the outside in template_preprocess_views_view_rss(). Therefore those have to be defined as public properties... and Ross::channel_items may need a rewrite to camel-case format to fulfill code style rules.

Issue description is also updated the with these findings.

Version: 9.1.x-dev » 9.3.x-dev

Drupal 9.1.10 (June 4, 2021) and Drupal 9.2.10 (November 24, 2021) were the last bugfix releases of those minor version series. Drupal 9 bug reports should be targeted for the 9.3.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Version: 9.4.x-dev » 9.5.x-dev
Category: Task » Bug report
Issue tags: +PHP 8.2
Parent issue: » #3275851: [META] Fix PHP 8.2 dynamic property deprecations
andypost’s picture

Category: Bug report » Task
Priority: Normal » Minor

Both elements already defined and used so probably \Drupal\views\Plugin\views\style\Rss::getChannelElements should be defined as as public and another method for namespaces

core/modules/views/views.theme.inc:921

  $variables['namespaces'] = new Attribute($style->namespaces);
...
  $variables['channel_elements'] = $style->channel_elements;

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Title: Rss views style plugin uses undefined class properties for namespaces and channel elements » Rss views style plugin channel_elements property needs rename

better title

quietone’s picture

Status: Active » Postponed

This is a coding standard fix and they are now done by sniff, not file. See #3346468: [meta] Fix class properties violating Drupal.NamingConventions.ValidVariableName.LowerCamelName

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.