This is a subissue of #1391216: Views integration for the 6.x-2.x and 7.x-1.x version

Problem/Motivation

When displaying a list of addresses with Views using fields, it would be nice to be able to add view, edit and delete links to the View. Of course, these links should only be shown if the action is permitted by the current user.

Proposed resolution

Implement three Views fields, each with its own handler. Each handler should check with the permissions class (UcAddressesPermissions) if it should display the action link.

Remaining tasks

  • Implement the three link fields.

User interface changes

None directly, but site builders will get an option in Views to add specific actions links as fields.

API changes

None.

A patch will follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MegaChriz’s picture

Status: Active » Needs review
FileSize
6.12 KB

This patch adds Views fields for view, edit and delete links by extending the Views handler "views_handler_field_entity". It depends on a patch from #1831424: Turn Ubercart Addresses address into an entity, as entity API functions are used in the implementation.

This could use some tests.

MegaChriz’s picture

Issue tags: +Needs tests
MegaChriz’s picture

Rerolled the patch in #1.

MegaChriz’s picture

Now with automated tests.

MegaChriz’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Committed #4 with two small changes in the automated test:

  1. The address book cache of each user in the test is cleared, to be sure no addresses from previous tests are still in there.
  2. Code comments.

Needs porting to 6.x-2.x.

MegaChriz’s picture

Status: Patch (to be ported) » Needs review
FileSize
16.35 KB

Patch for the 6.x-2.x version. Tested with both Views 6.x-2.x and Views 6.x-3.x.

MegaChriz’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Fixed

Committed #6 with a small difference: for edit and delete links I had forgotten to add drupal_get_destination() to the end of the link.

Setting issue back to the version it was originally reported for and mark it as fixed.

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