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.
My personal goal with this change is to hide the Project_Release_Downloads_Table in the project node rendering. I use the Project Release module for Issue Tracking but I am not wanting to publish a downloads table for each project. I attempted to fix this in CSS but there is no container or containers that allow me target the downloads table. I modified the project_release_node_view() hook to add a
element with a class of "project_release_downloads" using #prefix and #suffix elements.
Comment | File | Size | Author |
---|---|---|---|
#1 | project-add_div_container_around_project_release_downloads_table-1904784-1.patch | 784 bytes | mattreba |
Comments
Comment #1
mattreba CreditAttribution: mattreba commentedComment #2
hass CreditAttribution: hass commentedComment #3
dwwIn this case, wouldn't it be better to use a template preprocess function to just clobber
$node->content['project_release_downloads']
instead of wrapping it in a div and then hiding that via CSS?I'm not fundamentally opposed to adding a div, but a) it seems a bit like markup bloat in the common case and b) seems pointless to include all that markup and then hide it in this case.
Thoughts?
Thanks,
-Derek
Comment #4
drummproject_release should be smarter and not add the heading if there isn't content. display: none should be a last resort, it is much better to not send the markup in the first place.
Comment #5
dwwAlso true. ;) It's somewhat smart already, and only shows the table on projects that are configured to want releases. But it's not checking to make sure there *are* releases to display. Agree the header shouldn't show in that case. However, I think that's a separate bug since I think mattreba's talking about the case that there are releases, but he just doesn't want to display them on project nodes like we do.