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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drupalninja99’s picture

+1, this would be great. I wouldn't suppose this would be very difficult to implement.

drupalninja99’s picture

Here 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.

minorOffense’s picture

Can you post the sub module code? I'm curious to try it out.

drupalninja99’s picture

FileSize
1.53 KB

I 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.

minorOffense’s picture

Did 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.

drupalninja99’s picture

Well, 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.

Jeffrey C.’s picture

Hello 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.

Jeffrey C.’s picture

Status: Active » Closed (won't fix)

Dear 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.