- Issue created by @DamienMcKenna
- πΊπΈUnited States DamienMcKenna NH, USA
This adds some of the basic structure necessary, now to work out how to actually have the video's duration as an available value.
- πΊπΈUnited States DamienMcKenna NH, USA
Rerolled for 10.2, for anyone who wants to test it.
- Status changed to Needs review
5 months ago 2:33pm 20 June 2024 - πΊπΈUnited States DamienMcKenna NH, USA
This uses getID3 to get the duration in seconds, which are rounded to the nearest second.
- πΊπΈUnited States DamienMcKenna NH, USA
It might be worth spinning this off as a separate contrib module that replaces core's standard VideoFile plugin with its own and then adds all of the getID3 attributes.
- πΊπΈUnited States DamienMcKenna NH, USA
A bare version of #4 for loading via composer.
- Status changed to Needs work
5 months ago 2:44pm 20 June 2024 The Needs Review Queue Bot β tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request β . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
- πΊπΈUnited States DamienMcKenna NH, USA
I realized that it needed to check the parent plugin for possible attributes if the known one wasn't found.
- πΊπΈUnited States DamienMcKenna NH, USA
Minor mistake on the 10.2 patch.
- πΊπΈUnited States DamienMcKenna NH, USA
FYI I formatted the timestamp like this:
/** * Implements hook_preprocess_field() for "field_duration". */ function MYMODULE_preprocess_field__field_duration(array &$variables) { // Reformat the duration as a time string. foreach ($variables['items'] as $key => $item) { $duration = trim($item['content']['#markup']); $minutes = floor($duration / 60); $seconds = $duration - ($minutes * 60); $variables['items'][$key]['content']['#markup'] = $minutes . ':' . $seconds; } }
- π³πΏNew Zealand quietone
Hi, I merely glanced at the patch and saw the constant and I recalled there is a standard for naming. So, I am linking that here, https://www.drupal.org/docs/develop/standards/php/php-coding-standards#s... β . I think the name needs to change.
- πΊπΈUnited States DamienMcKenna NH, USA
Rerolled the bare patch for the latest 10.3.
- πΊπΈUnited States DamienMcKenna NH, USA
The standards don't really differentiate between global constants vs class constants, so I don't think it's necessary for class constants to be prefixed with the module's name as they are only available within that class? If I'm wrong on that then I'm happy to update it.