Problem/Motivation

Due to analytics and tracking, we need to add a variable parameter value to the MP3 player being rendered on a node.
Doing this change through the templating system was complicated as the relationship was 2 references away.
Using view alter hooks was not possible because the JS settings were made before the view was rendered.

Proposed resolution

Add an alter hook before sending the render array that contains the JS settings.

Issue fork audiofield-3226331

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

BetoAveiga created an issue. See original summary.

betoaveiga’s picture

StatusFileSize
new2.65 KB

Uploading the patch to allow alter JS settings for the JPlayer.

daniel.moberly’s picture

This patch does not apply against dev. Can you reroll?

betoaveiga’s picture

Sure, Daniel, I will add it as a reminder for later.

betoaveiga’s picture

StatusFileSize
new2.53 KB

Rerolling for latest 8.x-1.x.

daniel.moberly’s picture

Status: Active » Needs work

This patch currently breaks all other audiofield types (wavesurfer, etc.) using the constructor

ArgumentCountError: Too few arguments to function Drupal\audiofield\AudioFieldPluginBase::__construct(), 7 passed in /var/www/html/base/web/modules/custom/audiofield/src/Plugin/AudioPlayer/WavesurferAudioPlayer.php on line 44 and exactly 8 expected in Drupal\audiofield\AudioFieldPluginBase->__construct() (line 67 of modules/custom/audiofield/src/AudioFieldPluginBase.php).

betoaveiga’s picture

Okay, thanks, Daniel. It seems I need to overwrite the constructor JPlayerAudioPlayer only.
I will add a reminder to make that later.

betoaveiga’s picture

StatusFileSize
new2.74 KB

Adding a patch for 8.x-1.9

I will check later for the dev version.

afsch’s picture

StatusFileSize
new3.28 KB

Re-rolling patch 9 for the last updates in audiofield module.

astonvictor made their first commit to this issue’s fork.

astonvictor’s picture

Version: 8.x-1.9 » 8.x-1.x-dev

astonvictor’s picture

Status: Needs work » Fixed

thanks for the report.
I added an alter for all plugins - hook_audiofield_player_settings_alter(array &$settings, array $context)

merged to the dev version

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.