Problem/Motivation

Quoting @Bojhan in #1043198-37: Convert view modes to ConfigEntity:

We don't expose machine_name in tables generally

...but we currently do in the EntityListController. See EntityListController::buildHeader.

Proposed resolution

Remove the machine name from table generated by EntityListController.

Remaining tasks

Write patch. :-)

User interface changes

No more "Machine name" in Entity listings by default.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Issue tags: +Novice, +#pnx-sprint

Tagging

larowlan’s picture

Issue tags: -#pnx-sprint
RobW’s picture

If the machine names for nodes, view modes, fields, etc. aren't shown in the ui, how am I as a developer supposed to find them out? Inspect class names and guess from there, or insert a kpr() every time I want to write hook_anything? This seems like a dx regression to me.

tstoeckler’s picture

Well, they would be shown when you click on the edit link for an entity (view mode, node type, ...), just not in the overview listing.

tim.plunkett’s picture

Seeing it in the Field UI is helpful.

The Views listing has the machine name in the title text when hovering on the row.

RobW’s picture

IIRC, the concern is that the machine name clutters the ui and overloads the non-technical user with information. But we want the developer/site builder to have access to this information, preferably on overview and edit pages.

Having to hover a link and remember a string, or click through to a new page to be able to copy isn't optimal, especially if the machine name is something long and repetitive (as happens with Drupal sometimes :D ). Title attribute text isn't optimal for many users for a number of reasons either.

Like Tim mentioned, seeing the field machine names which often differ greatly from the human readable name in the UI is extremely useful if you want to quickly grok what the site's field naming scheme is, or check which fields were created and can be destroyed easily with the UI and which are provided by modules -- I and a few developers I know use the Title module naming scheme, where if a field is required and provided by a custom module we name it {name}_field instead of field_{name}. Probably not widespread practice, but another real world example.

How about all entity machine names are listed visually and selectably underneath their human readable names when a new permission is enabled, so you can scope machine names to only the roles that are likely to need them?

yoroy’s picture

> How about all entity machine names are listed visually and selectably underneath their human readable names when a new permission is enabled, so you can scope machine names to only the roles that are likely to need them?

I don't understand this. What does this mean?

> …click through to a new page to be able to copy isn't optimal

Nothing is ever optimal. It's about trade-offs. I don't think we should be optimizing the discoverability of the machine name at the cost of cluttering overview pages.

tstoeckler’s picture

> How about all entity machine names are listed visually and selectably underneath their human readable names when a new permission is enabled, so you can scope machine names to only the roles that are likely to need them?

I don't understand this. What does this mean?

There two things proposed here:

1. Add a permission such as "View machine-readable names" so that the site admin can choose who sees them and who doesn't.

2. Instead of having the machine names in a separate column, show them below the human-readable name/label (for those who are allowed to see them per 1.).

I first thought that 1. was a pretty nifty idea, but then I realized that the 80 percent use-case is probably a single administrator and the administrative account (uid == 1) bypasses all access checks so he/she will always see the machine names. Hmm...

RobW’s picture

tstoeckler that's a good point. I would say it's not quite 80%, since every site built by a firm/developer for an end user will own the superuser themselves and give their clients purpose built roles so they can't destroy the site, but enthusiasts and the mythical admin + nontechnical end user hybrid trying out the system themselves would be stuck with the full developer view.

We could do something similar with a module and the admin/config page instead of using permissions. That's a little more complexity on the api end.

yoroy’s picture

Adding a permission comes down to pushing of the decision off somewhere else, to an out-of-context place where it will be very hard to understand what the whole concept means. The name 'machine name' already implies that this isn't user-facing material. I don't think you can lump the whole group of site-builders in as a target audience, it's only for those who write actual code as well, which is a sub-set of the site builders group.

Showing it below the name is tricky too: it would increase, almost double, the height of each row for 1, relatively unimportant piece of data, thus halving the information densitiy of the screen. Lets not do that, look at the views listing for the amount of clutter that approach can lead to :)

I understand the need to have it available somewhere in the ui, but I haven't seen a convincing argument yet to stop us from moving it away from the listing into the individual entity settings form.

YesCT’s picture

Just adding a note that #1833104: Add a "translatable" column to Manage Fields is about adding a column.

fenda’s picture

I just thought of a flaw with this. In a listing you can have multiple items with the same label. There would be no way to differentiate between those items without a machine_name, right?

tstoeckler’s picture

In theory that sounds like a problem, but I think if you have two items with the same label you're doing it wrong ©. Labels are supposed to be "human-readable" and "Foo" vs. "Foo" is by no means that.

markpavlitski’s picture

Status: Active » Needs review
FileSize
825 bytes

The attached patch simply removes the machine name column.

EntityListController can be extended by other modules to add this column in, if it's needed in special cases.

Status: Needs review » Needs work

The last submitted patch, drupal-remove-machine-name-1831890-14.patch, failed testing.

markpavlitski’s picture

Status: Needs work » Needs review
FileSize
5.55 KB

This patch also adjusts the test scripts to match.

socketwench’s picture

Issue summary: View changes
Issue tags: -Novice

Novice issue cleanup.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Not sure if this is still an issue or not since the list builders were split out per-entity type. It may be an issue on some.

chishah92’s picture

Assigned: Unassigned » chishah92
chishah92’s picture

Status: Needs work » Needs review
FileSize
14.27 KB

Rerolled the patch.

tstoeckler’s picture

Status: Needs review » Needs work

That patch mostly looks like a revert of ancient core commits, probably due to a faulty merge. I think it makes sense to start from scratch here, in case this is still an issue.

chishah92’s picture

Assigned: chishah92 » Unassigned

The last submitted patch, 21: drupal-remove-machine-name-1831890-21.patch, failed testing.

hitesh-jain’s picture

Assigned: Unassigned » hitesh-jain
hitesh-jain’s picture

Assigned: hitesh-jain » Unassigned
Issue tags: -Needs reroll

I could apply the patch, so no reroll is needed. Applied against 8.2.x branch .
Removed Needs Reroll Issue tag.

jhedstrom’s picture

Version: 8.1.x-dev » 8.2.x-dev
Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Needs issue summary update

I'm not sure if this is even an issue anymore. I couldn't find any core list builders (aside from in the entity_test module) that were exposing the machine name.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Think this can be closed as there has been no follow up since moving to PNMI 7 years ago.

If still a valid task please reopen updating the issue summary.

Thanks!