* If the query parameter isn't present, then the URL of the current
* request is returned.
*
- * @see \Drupal\Core\EventSubscriber\RedirectResponseSubscriber::checkRedirectUrl()
- *
* @ingroup form_api
*
* @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0.
* Use the redirect.destination service.
+ *
+ * @see \Drupal\Core\EventSubscriber\RedirectResponseSubscriber::checkRedirectUrl()
+ * @see https://www.drupal.org/node/2448603
*/
function drupal_get_destination() {
return \Drupal::destination()->getAsArray();
*
* @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0.
* Use \Drupal::service('email.validator')->isValid().
+ *
+ * @see https://www.drupal.org/node/2912661
*/
function valid_email_address($mail) {
return \Drupal::service('email.validator')->isValid($mail);
* Drupal\Core\Template\Attribute, call
* \Drupal\Component\Utility\UrlHelper::stripDangerousProtocols() instead.
*
- * @see \Drupal\Component\Utility\UrlHelper::stripDangerousProtocols()
- * @see \Drupal\Component\Utility\UrlHelper::filterBadProtocol()
- *
* @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0.
* Use UrlHelper::stripDangerousProtocols() or UrlHelper::filterBadProtocol()
* instead. UrlHelper::stripDangerousProtocols() can be used in conjunction
* UrlHelper::filterBadProtocol() is functionality equivalent to check_url()
* apart from the fact it is protected from double escaping bugs. Note that
* this method no longer marks its output as safe.
+ *
+ * @see \Drupal\Component\Utility\UrlHelper::stripDangerousProtocols()
+ * @see \Drupal\Component\Utility\UrlHelper::filterBadProtocol()
+ * @see https://www.drupal.org/node/2560027
*/
function check_url($uri) {
return Html::escape(UrlHelper::stripDangerousProtocols($uri));
return \Drupal::translation()->formatPlural($size, '1 byte', '@count bytes', [], ['langcode' => $langcode]);
}
else {
- $size = $size / Bytes::KILOBYTE; // Convert bytes to kilobytes.
+ // Convert bytes to kilobytes.
+ $size = $size / Bytes::KILOBYTE;
$units = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
foreach ($units as $unit) {
if (round($size, 2) >= Bytes::KILOBYTE) {
* @return
* A translated date string in the requested format.
*
- * @see \Drupal\Core\Datetime\DateFormatter::format()
- *
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
* Use \Drupal::service('date.formatter')->format().
+ *
+ * @see \Drupal\Core\Datetime\DateFormatter::format()
+ * @see https://www.drupal.org/node/1876852
*/
function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) {
return \Drupal::service('date.formatter')->format($timestamp, $type, $format, $timezone, $langcode);
*
* @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
* Use \Drupal\Core\Asset\AssetCollectionOptimizerInterface::deleteAll().
+ *
+ * @see https://www.drupal.org/node/2317841
*/
function drupal_clear_css_cache() {
\Drupal::service('asset.css.collection_optimizer')->deleteAll();
*
* @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
* Use \Drupal\Core\Asset\AssetCollectionOptimizerInterface::deleteAll().
+ *
+ * @see https://www.drupal.org/node/2317841
*/
function drupal_clear_js_cache() {
\Drupal::service('asset.js.collection_optimizer')->deleteAll();
* 'renderer' service instead.
*
* @see \Drupal\Core\Render\RendererInterface::renderRoot()
+ * @see https://www.drupal.org/node/2912696
*/
function drupal_render_root(&$elements) {
return \Drupal::service('renderer')->renderRoot($elements);
* 'renderer' service instead.
*
* @see \Drupal\Core\Render\RendererInterface::render()
+ * @see https://www.drupal.org/node/2912696
*/
function drupal_render(&$elements, $is_recursive_call = FALSE) {
return \Drupal::service('renderer')->render($elements, $is_recursive_call);
* they are available.
*
* @see drupal_render()
+ * @see https://www.drupal.org/node/2912757
*/
function drupal_render_children(&$element, $children_keys = NULL) {
if ($children_keys === NULL) {
$output = '';
foreach ($children_keys as $key) {
if (!empty($element[$key])) {
- $output .= drupal_render($element[$key]);
+ $output .= \Drupal::service('renderer')->render($element[$key]);
}
}
return Markup::create($output);
*
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
* Use \Drupal::service('element_info')->getInfo() instead.
+ *
+ * @see https://www.drupal.org/node/2235461
*/
function element_info($type) {
return \Drupal::service('element_info')->getInfo($type);
*
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
* Use \Drupal::service('element_info')->getInfoProperty() instead.
+ *
+ * @see https://www.drupal.org/node/2235461
*/
function element_info_property($type, $property_name, $default = NULL) {
return \Drupal::service('element_info')->getInfoProperty($type, $property_name, $default);
// to reset the theme manager.
\Drupal::theme()->resetActiveTheme();
-
// Rebuild and reboot a new kernel. A simple DrupalKernel reboot is not
// sufficient, since the list of enabled modules might have been adjusted
// above due to changed code.