I have webform path and webform machine name, how can I get url object of this webform?

1 Answer 1


You can use the same route as for other entities: $webform_url = Url::fromRoute('entity.webform.canonical', ['webform' => 'my_webform_id']);

  • This is NOT a Symfony route object, this is a Drupal\Core\Url object. If this is the accepted answer, then the question is about URL objects, not route objects.
    – Hudri
    Jan 12, 2023 at 10:00
  • @Hudri Edited the question due to your remark.
    – EvilArgest
    Jan 12, 2023 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.