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 incore/modules/views/src/Plugin/views/style/RssExtended.phpto see that$this->namespacesand$this->channel_elementsare assigned some values without ever defining them
Proposed resolution
- Define both mentioned properties as public class properties
- See if
Rss::channel_itemshas to be rewritten in camel-case format toRss::channelElementsto 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 ofRss::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_elementsis 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
Comment #2
hctomUpdate: 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... andRoss::channel_itemsmay need a rewrite to camel-case format to fulfill code style rules.Issue description is also updated the with these findings.
Comment #5
andypostComment #6
andypostBoth elements already defined and used so probably
\Drupal\views\Plugin\views\style\Rss::getChannelElementsshould be defined as as public and another method for namespacesComment #7
andypostre-parented to #2052421: [META] Rename Views properties to core standards
Comment #9
andypostbetter title
Comment #10
quietone commentedThis 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
Comment #12
quietone commented