Skip to main content
improved formatting
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

For getting the current path in Drupal 7, Weyou use to use

current_path()

But current_path(), but in Drupal 8,

$url = Url::fromRoute('<current>');

To get the current path you use $url = Url::fromRoute('<current>');.

Source: https://www.drupal.org/node/2382211

For getting the current path in Drupal 7, We use to use

current_path()

But in Drupal 8,

$url = Url::fromRoute('<current>');

To get the current path.

Source: https://www.drupal.org/node/2382211

For getting the current path in Drupal 7, you use to use current_path(), but in Drupal 8 you use $url = Url::fromRoute('<current>');.

Source: https://www.drupal.org/node/2382211

Source Link
Nitesh Sethia
  • 2.3k
  • 16
  • 23

For getting the current path in Drupal 7, We use to use

current_path()

But in Drupal 8,

$url = Url::fromRoute('<current>');

To get the current path.

Source: https://www.drupal.org/node/2382211