Problem/Motivation

Once #3544339: Add support in StringFormatter for linking to the entity edit form lands and we can link the title to the edit page, it would be quite useful to have 'View' appear in the operations links. This nicely aligns with the changes to move local tasks into the top bar, since 'View' is now in the extras menu.

Proposed resolution

If available, add 'View' to the entity operations by default.

Remaining tasks

Review and commit.

User interface changes

Entities that are viewable at a canonical URL will get a "View" operation in their drop buttons, by default.

Introduced terminology

None.

API changes

There is no change to public API here, but the existing API's behavior will change in that it will return a "View" operation by default.

Data model changes

None.

Release notes snippet

TBD

Issue fork drupal-3548596

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pameeela created an issue. See original summary.

pameeela’s picture

Issue summary: View changes

phenaproxima made their first commit to this issue’s fork.

phenaproxima’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Is it possible to change "view" as a second option? I applied the MR and on the admin/content view the first operation is View when it use to be Edit. Think it still makes sense to be Edit as the title link already sends to view.

pameeela’s picture

I agree it should be last for now but the reason we want to add this is so we can link the title to edit instead. But that will be a new feature so certainly most existing instances would link the title to view

smustgrave’s picture

Will admit that will quite a change for people

ckrina’s picture

As mentioned in #3544339: Add support in StringFormatter for linking to the entity edit form, +1 to this change on a UX Manager perspective to solve the transition to a more standard pattern with the option to keep the old strategy. That provides a good and flexible transition/change management strategy.

phenaproxima’s picture

Component: views.module » entity system
Issue summary: View changes
Status: Needs work » Needs review
phenaproxima’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! That was my only feedback.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

I've merged the MR to 11.x. We need a separate MR for 11.2.x because the MR doesn't apply cleanly on it.

phenaproxima’s picture

Status: Needs work » Patch (to be ported)

Backport MR opened; since this changes behavior of an existing API, should we maybe check with the release managers that this is backport-safe?

lauriii’s picture

Status: Patch (to be ported) » Fixed

Realized 11.2.0 shipper already and it wasn’t a dev branch. I don’t think this qualifies for a backport so keeping 11.x only.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

arno_vgh’s picture

Just a quick note for those who came up to this issue and do not (yet) want the new 'view' operation to be added to (all) the entities, it can be removed using hook_entity_operation_alter().

Example:

/**
 * Implements hook_entity_operation_alter().
 */
function yourmodule_entity_operation_alter(array &$operations, EntityInterface $entity) {
  // Remove the operation for all entities.
  unset($operations['view']);
  // Remove for a specific entity type.
  if ($entity instanceof Node) {
    unset($operations['view']);
  }
}