tobimori/kirby-seo

Dual Language Setup Returns Error on Front-End

Closed this issue · 3 comments

Setup: Kirby 4.0.1 (Unmodded Starterkit) with the Plugin in question versioned 1.0.0 (Composer/Panel).

System: Nginx 1.25.3/Valet 4.5.0/PHP 8.1.25 - macOS Ventura 13.6.3 (shiny and new)

Returns error in the environment stated above when tested with two languages setup (Icelandic - English).

Works fine Vanilla with Mono-English.

Error Info:

Method name must be string

Refering to line 166 in ../plugins/kirby-seo/classes/Meta.php $meta[$tag] = $this->$valueOrKey();

Edit:
Triggered by the snippet in the head <?php snippet('seo/head'); ?>

 public function snippetData(): array
  {
    $metaRaw = array_merge($this->metaArray(), array_diff($this->metaDefaults, $this->consumed));
    $meta = [];
    foreach ($metaRaw as $tag => $valueOrKey) {
      if (is_callable($valueOrKey)) {
        $meta[$tag] = $valueOrKey();
        continue;
      }
 
      $meta[$tag] = $this->$valueOrKey();
    }
 
    $tags = [];
    foreach ($meta as $name => $value) {
      $tag = $this->resolveTag($name);
 
      foreach ((is_array($value) ? $value : [$value]) as $value) {
        if (is_a($value, 'Kirby\Content\Field') && $value->isEmpty()) continue;
        if (!$value) continue;

Thank you for reading

-j

Thanks for the report, I'll check that. (Use 0.4.0 for production for now, 1.0 is not released yet)

Couldn't reproduce this anymore with the other changes I made. Seems to work now.

No errors. No complaints. Well done.