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

TypeError and warning on preprocess_paragraph__oe_banner. #1248

Open
alaeak1 opened this issue Feb 24, 2023 · 0 comments
Open

TypeError and warning on preprocess_paragraph__oe_banner. #1248

alaeak1 opened this issue Feb 24, 2023 · 0 comments

Comments

@alaeak1
Copy link

alaeak1 commented Feb 24, 2023

Log:
1 - TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, Drupal\Core\Field\Plugin\Field\FieldType\StringItem given in str_replace() (line 1544 of /themes/contrib/oe_theme/oe_theme.theme).

2 - Warning: Attempt to read property "value" on string in /themes/contrib/oe_theme/oe_theme.theme on line 1545

How to reproduce:
Add this paragraph in any node, and try to render the node and you will get the type error.

Temporal fix to not get blocked:
Before:

  $variant = $paragraph->get('oe_paragraphs_variant')->first();
  if ($variant) {
    $variables['variant'] = str_replace('oe_banner_', '', $variant)->value;
  }

After:

  $variant = $paragraph->get('oe_paragraphs_variant')->first();
  if ($variant) {
    $variables['variant'] = str_replace('oe_banner_', '', $variant->getString());
  }
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

No branches or pull requests

1 participant