Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta4
Description: 

The current_path() is replaced by the <current> route. In case you want to link to the current page, use the <current> url object:

$url = Url::fromRoute('<current>');
\Drupal::l('title', $url);

Instead of comparing current_path(), compare the current route:

\Drupal::routeMatch()->getRouteName() == 'composer_manager.settings'

In case you need the path, call toString() on the $url object:

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

as current_path() was in D7 [updated 03.28.2016]

$current_path = \Drupal::service('path.current')->getPath();

Together with this change, it is now impossible to set $element['#ajax']['path'], you must set $element['#ajax']['url'] instead, which accepts a \Drupal\Core\Url object.

Finally, for JavaScript code: drupalSettings.path.basePath doesn't exist anymore and was replaced with drupalSettings.path.baseUrl. However, 99% of the time you don't want to use those settings anyway, use Drupal.url() instead!

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

plach’s picture

This also the correct replacement for request_path().