Since points can be added to any entity via entity_reference, therefore multiple points fields can exist on the same entity. This makes routing for the points movement tab and the filtering on the backend views more dynamic.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skyredwang created an issue. See original summary.

skyredwang’s picture

Category: Feature request » Bug report
Priority: Normal » Major

With latest version, the points movement views on an entity has path /entity_type/entity_id/points. The last part points is hard coded. It should be replaced by the field name without the "field" prefix. This means 3 places need to be updated:

1. PointsMovementRoutes::routes() needs to generate new routes like /entity_type/entity_id/field_name
2. EntityPointsMovementController::page() needs to accept new route
3. views.view.point_movement.yml needs to be able to accept [field_name] as a filter to filter out points movements which don't belong to the certain entity reference.

alan_blake’s picture

Status: Active » Needs review
FileSize
3.44 KB

please review.

alan_blake’s picture

skyredwang’s picture

Status: Needs review » Needs work
  1. +++ src/Routing/PointsMovementRoutes.php	(revision )
    @@ -20,13 +20,14 @@
    +        $field_name = substr($config_entity->get('field_name'),6);
    

    need a space

  2. +++ src/Controller/EntityPointsMovementController.php	(revision )
    @@ -50,8 +50,8 @@
    +      if ($config_entity->get('type') === 'entity_reference' && $config_entity->get('settings')['target_type'] === 'point' && $config_entity->get('entity_type') == $path[1] && substr($field_name,6) == $path[3]) {
    

    need a space

  3. +++ src/Plugin/Derivative/PointsLocalTask.php	(revision )
    @@ -50,8 +50,9 @@
    +        $field_name = substr($config_entity->get('field_name'),6);
    

    another space is needed

skyredwang’s picture

The patch is also not apply-able. How did you generate the patch?

alan_blake’s picture

alan_blake’s picture

  • skyredwang committed 67c3299 on 8.x-1.x authored by alan_blake
    Issue #2886043 by alan_blake, skyredwang: Handle multiple points field...
skyredwang’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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