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.
It would be great if you could expose the machine name of individual nodes to Views.
For example, in the case where you want to pull out a particular node in Views, this would allow to filter by machine name rather than nid. This would be far more robust to export - at the moment I would have to update the nid filter on deployment.
Or is this already available in the 1.x or 2.x-dev branches?
Comment | File | Size | Author |
---|---|---|---|
#4 | defaultcontent_views.zip | 1.53 KB | drupalninja99 |
#2 | Default content views integration.png | 23.14 KB | drupalninja99 |
Comments
Comment #1
drupalninja99 CreditAttribution: drupalninja99 commented+1, this would be great. I wouldn't suppose this would be very difficult to implement.
Comment #2
drupalninja99 CreditAttribution: drupalninja99 commentedHere is a sub-module I created called defaultcontent_views that adds the machine name as a field and more importantly a filter. It doesn't have to use a custom handler or anything, this is pretty straightforward.
It would probably make more sense to go ahead and create this as a patch to the defaultcontent rather than a sub-module, so I can refactor a bit and patch to the 1x or 2x dev branches if you would like. It's a very simple module.
Comment #3
minorOffense CreditAttribution: minorOffense commentedCan you post the sub module code? I'm curious to try it out.
Comment #4
drupalninja99 CreditAttribution: drupalninja99 commentedI am using this on a project and it works for me. I worry that default content isn't super-actively being worked on so this might be a moot point if this module gets replaced by something else. But this module works good for me, this could be a sub-module added to the default content project.
Comment #5
minorOffense CreditAttribution: minorOffense commentedDid you ever consider writing a plugin for views to use the machine name of a node as the No Results behavior?
Would let you define a node type of
noresultsviews
and then assign machine names to different nodes with no results message.Then in views, under the No Results Behavior, instead of selecting a "Rendered Entity" by id, you'd use the machine name. Thus allowing your exported view to use the defaultcontent you've supplied. Best of all, since you're using nodes for no results behavior, they can be edited, translated or whatever by content authors.
Either way, just a thought.
(If you're not interested in writing this addon, I may try my hand at it)
The project isn't terribly active, you're right. But a few install profiles are using the module (Panopoly comes to mind) which means someone wants this thing to keep going.
Comment #6
drupalninja99 CreditAttribution: drupalninja99 commentedWell, I would say I am pretty much done with it at this point. You can take the ball and run with it if you like but I doubt I have much time to mess with this anymore since the piece I needed to work is working now.
Comment #7
Jeffrey C. CreditAttribution: Jeffrey C. commentedHello there!
Thank you for your contribution! I'll make sure I keep this in mind. I'll test it and if it's going all right, include it in the next available release. Meanwhile, please take a minute to check out #1869366: Future Plan.
Comment #8
Jeffrey C. CreditAttribution: Jeffrey C. commentedDear all,
No features will be added to this module. Please check UUID Features Integration, a more flexible alternative. Check #1869366: Future Plan for more details.