Problem/Motivation

TypeError: strtr(): Argument #1 ($string) must be of type string, array given in strtr() (Zeile 570 in /vendor/twig/twig/src/Extension/CoreExtension.php)

The issue seems to be caused by this line:
{{ paragraph.field_image_clip_path.value|replace({"clip-path": "shape-outside"}) }}
in
https://git.drupalcode.org/project/drowl_paragraphs/-/blob/8.x-3.x/modul...

looks like
paragraph.field_image_clip_path.value is an array here?

The resulting PHP code is:

// line 22
                    echo $this->extensions['Drupal\Core\Template\TwigExtension']->escapeFilter($this->env, twig_replace_filter($this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["paragraph"] ?? null), "field_image_clip_path", [], "any", false, false, true, 22), "value", [], "any", false, false, true, 22), 22, $this->source), ["clip-path" => "shape-outside"]), "html", null, true);
                    echo "

Steps to reproduce

dgs customer issue, see internal details.

Proposed resolution

Remaining tasks

  1. Check other tpl files and our templates for the same code
  2. Check other branches beside 3.x for the same code
  3. Fix the issue
  4. Test
  5. Release new version

User interface changes

API changes

Data model changes

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

Anybody created an issue. See original summary.

anybody’s picture

Issue summary: View changes
anybody’s picture

Issue summary: View changes

thomas.frobieter made their first commit to this issue’s fork.

  • thomas.frobieter committed 09a6d5f on 8.x-3.x
    Issue #3309184: TypeError: strtr(): Argument #1 ($string) must be of...
anybody’s picture

Version: 8.x-3.x-dev » 4.x-dev

Same issue exists for 4.x

thomas.frobieter’s picture

Version: 4.x-dev » 8.x-3.x-dev

Still buggy in 3.x .. I'll create a new issue fork.. and fix 4.x afterwards.

  • thomas.frobieter committed 57e535c on 8.x-3.x
    Issue #3309184 by thomas.frobieter, Anybody: TypeError: strtr():...
thomas.frobieter’s picture

4.x is not affected! So the last commit to 3.x should fix this finally.

thomas.frobieter’s picture

Status: Active » Fixed

  • thomas.frobieter committed e23ff33 on 8.x-3.x
    Issue #3309184 by thomas.frobieter, Anybody: TypeError: strtr():...

Status: Fixed » Closed (fixed)

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