By norman.lol on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x-1.x
Introduced in version:
8.x-1.0-beta6
Description:
ShURLy's internal helpers are renamed to follow Drupal coding standards. The old names still work, but they trigger an E_USER_DEPRECATED error and will be removed in 8.x-1.0 (#3622234).
| Deprecated | Replacement |
|---|---|
_surl($path, $options) |
shurly_url($path, $options) |
_sl($text, $path, $options) |
shurly_link($text, $path, $options) |
DefaultController::shurly_service_access_api_key() |
DefaultController::accessApiKey() |
DefaultController::shurly_service_shorten() |
DefaultController::shorten() |
DefaultController::shurly_service_expand() |
DefaultController::expand() |
Signatures and return values are unchanged. Route names and paths (/shurly/api/shorten, /shurly/api/expand) are unchanged.
Before
$url = _surl($hash, ['absolute' => TRUE]);
$link = _sl($text, $hash);
After
$url = shurly_url($hash, ['absolute' => TRUE]);
$link = shurly_link($text, $hash);
Controller edge cases
The shurly_service.shorten and shurly_service.expand routes now call shorten(), expand() and accessApiKey(). Routes that still reference the old method names keep working and trigger the deprecation.
- If a
RouteSubscribercompares_controlleror_custom_accesswith the old strings (for example'\Drupal\shurly_service\Controller\DefaultController::shurly_service_shorten'), compare against the new method names instead. - If you override
shurly_service_shorten(),shurly_service_expand()orshurly_service_access_api_key()in a subclass, override the new methods instead. The routes no longer call the old names.
Impacts:
Module developers