Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293926

$route_match->getParameter('taxonomy_term') is not filled with object.

$
0
0

When fetching the object from a routeMatch object, the object is not always filled correctly when fetching it via

$route_match = \Drupal::routeMatch();
$route_match->getParameters(); // or
route_match->getParameter('taxonomy_term');

The parameter 'node' is a full correct object on the following pages in D8.0.0 (but in a previous rc-version, it was not the case):
/node/3
/node/3/delete
/node/3/workflow (using contrib Workflow module) : 'node' => object Drupal\node\Entity\Node(24)

But on the next page, the parameter is not filled with an object.
/taxonomy/term/3 : 'taxonomy_term' => object Drupal\taxonomy\Entity\Term
/taxonomy/term/3/edit : 'taxonomy_term' => object Drupal\taxonomy\Entity\Term
/taxonomy/term/3/workflow : 'taxonomy_term' => string(1) "3"

Below, you find my routing.yml data. Is this a bug? or is something missing? I tested with and without the commented lines - there is no difference.
I did not test this on user or a custom entity type, yet.

entity.node.workflow_history:
  path: '/node/{node}/workflow/{field_name}'
  defaults:
    _title: 'Workflow history'
    _controller: '\Drupal\workflow\Controller\WorkflowTransitionListController::historyOverview'
    field_name: ~
  requirements:
    _custom_access: '\Drupal\workflow\Controller\WorkflowTransitionListController::historyAccess'
    _module_dependencies: 'node'
#  options:
#    parameters:
#      entity:
#        type: entity:{entity_type}

entity.taxonomy_term.workflow_history:
  path: '/taxonomy/term/{taxonomy_term}/workflow/{field_name}'
  defaults:
    _title: 'Workflow history'
    _controller: '\Drupal\workflow\Controller\WorkflowTransitionListController::historyOverview'
    field_name: ~
  requirements:
    _custom_access: '\Drupal\workflow\Controller\WorkflowTransitionListController::historyAccess'
    _module_dependencies: 'taxonomy'
#    taxonomy_term: \d+
#  options:
#    parameters:
#      entity:
#        type: entity:{entity_type}

Viewing all articles
Browse latest Browse all 293926

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>