The ability to set machine names for the displays is one of the absolute _best_ features of views 3. Would it be prohibitively difficult to allow users to set machine names for fields as well? Right now when I make a views-view-field.tpl.php I have to include the auto-generated machine name in the file name, which could change if I make even minor changes to the fields in the view. It also makes it hard to quickly see which files are for which fields when I have a bunch of 'nid' fields that I am turning into different links in the template files. It would be great if you could set the machine name for a field in the views interface.

Thanks again for making the change to allow users to set the machine name for displays...awesome.

Comments

dawehner’s picture

In general this would be a cool feature but it can produce problems.

What if you change the name of a field, should the settings in a table style be changed as well.
What about the names of template files etc. So the user should be informed that he really have to know what he does at the moment.

dawehner’s picture

Pushed the current progress to http://drupal.org/sandbox/dereine/1073764

kevinob11’s picture

Thanks for the update! I agree that the feature would be pretty dicey to use if you were not absolutely sure of what you were doing. I had thought of tpl files, but not all of the interface based settings, I can see how that would be problematic. I would still love to see it, but can understand any hesitance to merge it to the main views repo.

kevinob11’s picture

I was thinking about this again today, and I think maybe a special field handler would work for this. The main thing I would use this for is so I can name .tpl.php files with something that actually matches their function. Then I usually do a ton of work in that template file and its corresponding preprocess function. So in reality I very seldom actually need the content of the field to be defined in the ui. With that in mind it could just be the an option in the "Custom Text" global field handler, or its own unique field handler as opposed to being an available option in all field handlers.

This being said, I don't fully understand the ramifications of a change like this, so if the above is less practical or just plain crazy feel free to disregard it.

dawehner’s picture

If you really do a bunch of stuff in your template/preproces you might apply logic there. Please don't do this and use real handlers.

That's just a general suggestion.

kevinob11’s picture

Any updates on this?

Thanks,

Kevin

kharbat’s picture

subscribing to this feature..

setting a machine name for fields in views is a really helpful feature.. since most of auto generated field names are long and not really convenient..

dawehner’s picture

To be able to do this several things has to be done:

  • Something like a $view->rename_item() has to be introduced
  • This rename_item has to be invokved to displays, styles, etc. so plugins can react on this change.
MustangGB’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)