Hello,
I'm the new one here, just a user who wanted to use this module.
Frankly, I really didn't appreciate that Turnstyle now depends on the Keys module.
I mean, it used to be great: there were just two fields—one for the key, one for the secret key—and that was it.
Now, instead, it has been decided to rely on an external module, which is installed by only 34 people and isn't covered by Drupal's security policy. I have absolutely nothing against the Keys module—of course not!
But I think this functionality should be made optional, and users should be allowed to use the module as it has always been: simple and quick.
Honestly, I haven’t been able to configure Turnstyle now—probably due to my own technical limitations—I keep getting an error when I enter the keys, but I hope I’ve made my point clear.
Please, let people have the choice...
---
Would you like help polishing this message further before posting it somewhere?
To be honest, I also meet this problem on the homepage of the site, with the nodes. My Screen Reader reads me first the author and then the title of the node. I would like it to work like the other themes, first the title and then the author, but not being a programmer I don't know where to get my hands. Clearly, I will solve the problem with a view that acts as a homepage, but it's not the solution.
ok, I write this for people that could have same problem.
The solution that I have found is to write a custom module.
Ok, Deepseek writes it for me, I adjust it and you can use this solution and works:
1.
First of all create 2 field in your content type, filesize and duration, they should be numbers.
2. The module require getid3, so:
composer require james-heinrich/getid3
3. Create a subdirectory into modules/custom and call it for example audiometadatahelper.
Put there 2 files, audiometadatahelper.info.yml and audiometadatahelper.module.
4.
Content of audiometadatahelper.info
name: audioMetadata Helper
description: 'provides the values of size and duration and writes them in the fields'
type: module
core_version_requirement: ^11
package: Custom
5. Content of audiometadatahelper.module
<?php
use Drupal\Core\Entity\EntityInterface;
use Drupal\media\MediaInterface;
use Drupal\file\FileInterface;
/**
* Implements hook_entity_presave().
*/
function audiometadatahelper_entity_presave(EntityInterface $entity) {
// Verify it is a podcast content type
if ($entity->getEntityTypeId() === 'node' && $entity->bundle() === 'podcast') {
// Load media audio (field_file_audio) field
if ($entity->hasField('field_file_audio') && !$entity->get('field_file_audio')->isEmpty()) {
$media_entity = $entity->get('field_file_audio')->entity;
if ($media_entity instanceof MediaInterface) {
// File field in the media Type(modify if necessary)
$media_file_field = 'field_media_audio_file';
if ($media_entity->hasField($media_file_field)) {
$audio_file = $media_entity->get($media_file_field)->entity;
if ($audio_file instanceof FileInterface) {
// 1. Save the file size
if ($entity->hasField('field_filesize')) {
$entity->set('field_filesize', $audio_file->getSize());
}
// 2. Calculate and save the duration
if ($entity->hasField('field_duration')) {
$uri = $audio_file->getFileUri();
$duration = audiometadatahelper_get_audio_duration($uri);
$entity->set('field_duration', $duration);
}
}
}
}
}
}
}
/**
* Extract the duration of audio using Getid3.
*/
function audiometadatahelper_get_audio_duration($uri) {
$realpath = \Drupal::service('file_system')->realpath($uri);
if (class_exists('getID3')) {
$getID3 = new getID3();
try {
$file_info = $getID3->analyze($realpath);
return $file_info['playtime_seconds'] ?? 0;
} catch (\Exception $e) {
\Drupal::logger('audiometadatahelper')->error('Errore analisi audio: @error', ['@error' => $e->getMessage()]);
}
}
return 0;
}
6. Install the module and enjoy! When you upload a file and save the content, filesize and duration will be populated, so you can map them from the podcast module.
Finally, I want to clarify that I am absolutely not a programmer. I just found a solution that works for me.
Maybe I hope to help others and save their hours of study.
ah, I'm on drupal11
@tolstoydotcom thank you very much!
You are a genius!
Solved without problem.
A great thank you again
Sorry, it seems that also visually main menu remains always expanded.
Can you check the website and tell me if you can exapnd or reduce the menu?
My screen reader find the "toggle menu" button, but it seems not working, at least on my opinion.
drein → created an issue.
Yes, nvda-addon is an extension of all plugin of NVDA, a screen reader that allow blind people to use windows.
https://addons.nvda-project.org
Unfortunately they put a "-" in the extension, so Drupal doesn't allow to submit that sort of file.
I propose the question, is there no way to force Drupal to accept the dashes?
Hello and thank you very much for your response!
When I'm going to create the field, I select file upload, then in the extensions I type: nvda-addon
The error is:
The list of allowed extensions is not valid. Allowed characters are a-z, 0-9, '.', and '_'. The first and last characters cannot be '.' or '_', and these two characters cannot appear next to each other. Separate extensions with a comma or space.
Separate extensions with a comma or space. Each extension can contain alphanumeric characters, '.', and '_', and should start and end with an alphanumeric character.
So the "-" character is not allowed.
Can I force it in some manner?