Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Yes, it's a view of a commerce core entity (commerce_product). I was trying to create a rss of products going below a certain stock feed, so that backorder systems could pick products from that feed.
Is there any way to patch the module so it can be independent of this node.created field? I don't see any other reason for it not working with other entities once this issue is fixed.
<?php
function views_rss_core_views_query_alter(&$view, &$query) {
if ($view->style_plugin->definition['handler'] == 'views_plugin_style_rss_fields') {
// Select the most recent node creation date for <pubDate> element.
$query->fields['views_rss_created'] = array(
'field' => 'created',
'table' => 'node',
'alias' => 'views_rss_created',
);
// Select the most recent node update date for <lastBuildDate> element.
$query->fields['views_rss_changed'] = array(
'field' => 'changed',
'table' => 'node',
'alias' => 'views_rss_changed',
);
}
}
;?>
Maybe there could be a way to override these dates in the views config, eventually with another field from the view?
I have added a new hook for other modules to be able to define new sources for date elements (<pubDate> and <lastBuildDate>). All core Drupal's view types will be predefined, but all others (like commerce_product in your case) would need to be provided by an external module.
It is not pushed yet though, as at the moment I am in the middle of pretty heavy changes (new and updated existing hooks, moving around and renaming files, probably renaming theme functions as well - essentially decided on some proper cleaning, as it was all a bit messy there before).
Also, still considering dropping in a row plugin, even though I have rejected it before - haven't finally made my mind about it yet.
Fixed in the most recent dev version, just pushed. Please clone from git of wait for d.o to rebuild archive files.
Also, please note that there were some big changes in file names/locations, theme function names etc, so I'd suggest to delete old module files completely before fetching one ones. Also, if you kept configuration of your old view, it's not going to work anymore either, as the structure on plugin options changed as well.
Comments
Comment #1
maciej.zgadzaj CreditAttribution: maciej.zgadzaj commentedAh yes, the date selection works for node-based views only now... Is it Drupal Commerce module you are using here?
Comment #2
farald CreditAttribution: farald commentedYes, it's a view of a commerce core entity (commerce_product). I was trying to create a rss of products going below a certain stock feed, so that backorder systems could pick products from that feed.
Is there any way to patch the module so it can be independent of this node.created field? I don't see any other reason for it not working with other entities once this issue is fixed.
Maybe there could be a way to override these dates in the views config, eventually with another field from the view?
Comment #3
maciej.zgadzaj CreditAttribution: maciej.zgadzaj commentedI have added a new hook for other modules to be able to define new sources for date elements (
<pubDate>
and<lastBuildDate>
). All core Drupal's view types will be predefined, but all others (likecommerce_product
in your case) would need to be provided by an external module.It is not pushed yet though, as at the moment I am in the middle of pretty heavy changes (new and updated existing hooks, moving around and renaming files, probably renaming theme functions as well - essentially decided on some proper cleaning, as it was all a bit messy there before).
Also, still considering dropping in a row plugin, even though I have rejected it before - haven't finally made my mind about it yet.
Comment #4
maciej.zgadzaj CreditAttribution: maciej.zgadzaj commentedFixed in the most recent dev version, just pushed. Please clone from git of wait for d.o to rebuild archive files.
Also, please note that there were some big changes in file names/locations, theme function names etc, so I'd suggest to delete old module files completely before fetching one ones. Also, if you kept configuration of your old view, it's not going to work anymore either, as the structure on plugin options changed as well.
Comment #5
maciej.zgadzaj CreditAttribution: maciej.zgadzaj commentedAlso please read Adding channel <pubDate> and <lastBuildDate> elements for non-core view types.
Comment #6
farald CreditAttribution: farald commentedThis is just great!
Thank you lots for this fix! :)