Skip to content

Data inheritance not working #4

Open
@tanc

Description

@tanc

I've been trying out the changes from #1 and am struggling to get data inheritance to work. According to @EvanLovely in pattern-lab#36 (comment) this should be working.

I'm using a fork of Phase2's pattern lab starter and this is my composer.json:

{
  "name": "phase2/pattern-lab-starter",
  "description": "Phase2 Pattern Lab for Drupal based on Pattern Lab's Drupal Edition",
  "keywords": [
    "pattern lab",
    "drupal"
  ],
  "homepage": "https://github.com/phase2/pattern-lab-starter",
  "license": "GPL-2.0+",
  "authors": [
    {
      "name": "Evan Lovely",
      "role": "Lead Developer"
    }
  ],
  "support": {
    "issues": "https://github.com/phase2/pattern-lab-starter/issues"
  },
  "autoload": {
    "psr-0": {
      "PatternLab": "core/src/"
    }
  },
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/drupal-pattern-lab/patternlab-php-core.git"
    }
  ],
  "require": {
    "php": ">=5.5.9",
    "pattern-lab/core": "^2.8.0",
    "pattern-lab/patternengine-twig": "^2.0.0",
    "pattern-lab/styleguidekit-twig-default": "^3.0.0",
    "pattern-lab/drupal-twig-components": "^2.0.0",
    "pattern-lab/plugin-faker": "^2.0",
    "evanlovely/plugin-twig-namespaces": "^1.0",
    "aleksip/plugin-data-transform": "^1.1"
  },
  "scripts": {
    "post-install-cmd": [
      "PatternLab\\Installer::postInstallCmd"
    ],
    "post-update-cmd": [
      "PatternLab\\Installer::postUpdateCmd"
    ],
    "post-root-package-install": [
      "PatternLab\\Installer::setProjectInstall",
      "PatternLab\\Installer::getSuggestedStarterKits",
      "PatternLab\\Installer::getConfigOverrides"
    ],
    "post-package-install": [
      "PatternLab\\Installer::postPackageInstall"
    ],
    "post-package-update": [
      "PatternLab\\Installer::postPackageUpdate"
    ],
    "pre-package-uninstall": [
      "PatternLab\\Installer::prePackageUninstall"
    ]
  },
  "extra": {
    "patternlab": {
    }
  }
}

It might be entirely possible that I need to install other forked repos but its not clear to me what I need.

My understanding is that aleksip/plugin-data-transform should provide the data inheritance.

My simple test scenario is:

Parent template:

<div class="paragraph-text-only__text-long">
  {% include "@atoms/fields/text-long/text-long.twig" %}
</div>

Included template (text-long.twig):

{{ content }}

The included template also has some associated data in text-long.json:

{
  "content": "Some test content"
}

When I view the parent template I see errors:

Notice: Array to string conversion in /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Environment.php(462) : eval()'d code on line 19 Call Stack: 0.0002 263464 1. {main}() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/core/console:0 0.0393 4339136 2. PatternLab\Console::run() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/core/console:46 0.0416 4572504 3. PatternLab\Console\Commands\GenerateCommand->run() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/pattern-lab/core/src/PatternLab/Console.php:91 0.0588 6514696 4. PatternLab\Generator->generate() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/pattern-lab/core/src/PatternLab/Console/Commands/GenerateCommand.php:42 0.0749 6888824 5. PatternLab\PatternData::gather() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/pattern-lab/core/src/PatternLab/Generator.php:69 0.1822 10144408 6. PatternLab\PatternData\Helpers\PatternCodeHelper->run() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/pattern-lab/core/src/PatternLab/PatternData.php:209 3.0459 41953616 7. PatternLab\PatternEngine\Twig\Loaders\PatternLoader->render() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/pattern-lab/core/src/PatternLab/PatternData/Helpers/PatternCodeHelper.php:89 3.0459 41953616 8. Twig_Environment->render() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/pattern-lab/patternengine-twig/src/PatternLab/PatternEngine/Twig/Loaders/PatternLoader.php:119 3.1064 43015848 9. Twig_Template->render() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Environment.php:362 3.1064 43032560 10. Twig_Template->display() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Template.php:411 3.1064 43033024 11. Twig_Template->displayWithErrorHandling() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Template.php:403 3.1064 43033096 12. __TwigTemplate_ffe61fee2246b15f94ee22ff8815e151d63c4190ab0da22d17d478f808ff4e6d->doDisplay() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Template.php:432 3.1072 43875792 13. Twig_Template->display() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Environment.php(462) : eval()'d code:33 3.1072 43876064 14. Twig_Template->displayWithErrorHandling() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Template.php:403 3.1072 43876064 15. __TwigTemplate_3275ef305a7d7efaddc7a0078b511bbf2e63fb899408c45405c3479f2c187593->doDisplay() /Users/tanc/Sites/l.install_profile/gitroot/web/themes/custom/site_theme/pattern-lab/vendor/twig/twig/lib/Twig/Template.php:432 Array

Is there anything I'm missing? Any advice on where to start looking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions