Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By 5003 on
I have written a function within locale.module to display a block with hyperlinks that I want to use to set cookies similar to the following:
$path = preg_replace("/.+\/\/[^\/]+(.*)/", "\$1/", $base_url);
setcookie("locale", 'en', time() + 3600 * 24 * 365, $path);
Can anyone explain how to set such a cookie - e.g. the format of the link and the required location of the code above?