Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statamic v5 fix code embed #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

clementmas
Copy link

I installed this package on Statamic v5 and got this error:

ErrorException: Array to string conversion in file vendor/simonridley/tracking-code-manager/src/TrackingCodeTags.php on line 41

The code fields of tracking-codes.yaml are now apparently nested one level deeper:

enabled: true
scripts:
  -
    id: lxsrgt5v
    enabled: true
    name: 'Cookie Banner'
    script:
      code: '<script src="..."></script>'
      mode: htmlmixed
    position: head

So changing the line proposed in this PR fixed my issue.

@replete
Copy link

replete commented Jul 4, 2024

Screenshot 2024-07-04 at 13 52 59

Can we get this fix in? Does not work in v5.

@bland-industries
Copy link

I ran into this and am thinking a condition would work best to allow for older version yaml files

if (is_array($script)) {
    $script = $script['code'];
} 
$output .= $script;

@clementmas
Copy link
Author

That's a good point @bland-industries. Thanks.

@simonridley I think this PR is safe to merge.

@jnbn
Copy link
Contributor

jnbn commented Oct 19, 2024

@simonridley can you accept this and release when you're available? Happy to help you to manage PR's and releases if you need help. (As I just saw your message on the other PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants