Account created on 12 June 2012, about 12 years ago
#

Recent comments

πŸ‡§πŸ‡ͺBelgium paulvb

We had an edge case where the hook_file_url_alter was needed with urls altered by the cdn module.

We are serving files from s3, but we proxy this through our own apache so end users get these files from our own cdn providers. I was a bit shocked finding out that the cdn module decorates the core FileUrlGenerator and leaves out $this->moduleHandler->alter('file_url', $uri);...

I ended up decorating the cdn FileUrlGenerator with my own FileUrlGenerator, but this pattern could give problems if other modules want to do the same..

πŸ‡§πŸ‡ͺBelgium paulvb

I had the same issue for a very specific use case. It's a bit of a hack, but I discovered that you can initiate the session and access the session ID by calling \Drupal::currentUser()->getAccount(); within the user_login hook and then session service will return the id...

In drupal 9 session manager had a method getid that generated one if none was present. https://www.drupal.org/node/3006306 β†’

public function getId() {
$id = parent::getId();

if (empty($id)) {
// Legacy code might rely on the existence of a session ID before a real
// session exists. In this case, generate a random session ID to provide
// backwards compatibility.
@trigger_error('Calling ' . __METHOD__ . '() outside of an actual existing session is deprecated in drupal:9.2.0 and will be removed in drupal:10.0.0. This is often used for anonymous users. See https://www.drupal.org/node/3006306 β†’ ', E_USER_DEPRECATED);
$id = Crypt::randomBytesBase64();
$this->setId($id);
}
return $id;
}

πŸ‡§πŸ‡ͺBelgium paulvb

I fixed this issue by declaring caption variable, so it will never be null

diff --git a/colorbox/colorbox.theme.inc b/colorbox/colorbox.theme.inc
index a38be6bc0..2e4f95344 100644
--- a/docroot/modules/contrib/colorbox/colorbox.theme.inc
+++ b/docroot/modules/contrib/colorbox/colorbox.theme.inc
@@ -138,6 +138,7 @@ function template_preprocess_colorbox_formatter(&$variables) {
$variables['url'] = $file_url_generator->generateAbsoluteString($image_uri);
}

+ $caption = '';
// If File Entity module is enabled, load attribute values from file entity.
if (\Drupal::moduleHandler()->moduleExists('file_entity')) {
// File id of the save file.

Production build 0.69.0 2024