emulsify icon indicating copy to clipboard operation
emulsify copied to clipboard

Issue with Bamboo Twig

Open sinyayadynya opened this issue 6 years ago • 1 comments

Hi, I want to use Bamboo Twig (https://www.drupal.org/project/bamboo_twig), but after creating the following 'components/_twig-components/functions/pl_bamboo_load_currentuser.function.php' file with:

<?php
/**
 * @file
 * Add "bamboo_load_currentuser" function for Pattern Lab.
 */

$function = new Twig_SimpleFunction('bamboo_load_currentuser', function ($string) {
  return $string;
});

I'm getting the following error while doing 'yarn start':

PHP Warning:  Invalid argument supplied for foreach() in ../web/themes/custom/rw/components/_twig-components/functions/add_attributes.function.php on line 61
PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function PatternLab\PatternEngine\Twig\TwigUtil::{closure}(), 0 passed in ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Environment.php(497) : eval()'d code on line 101 and exactly 1 expected in ../web/themes/custom/rw/components/_twig-components/functions/pl_bamboo_load_currentuser.function.php:7
Stack trace:
#0 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Environment.php(497) : eval()'d code(101): PatternLab\PatternEngine\Twig\TwigUtil::{closure}()
#1 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Template.php(427): __TwigTemplate_cbf5d6a87d361cc7730e5eae5d8b6b1c7e920bb86d13afa1de36a8a43dcc5a8a->doDisplay(Array, Array)
#2 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Template.php(398): Twig\Template->displayWithErrorHandling(Array, Array)
#3 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src in ../web/themes/custom/rw/components/_twig-components/functions/pl_bamboo_load_currentuser.function.php on line 7

Fatal error: Uncaught ArgumentCountError: Too few arguments to function PatternLab\PatternEngine\Twig\TwigUtil::{closure}(), 0 passed in ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Environment.php(497) : eval()'d code on line 101 and exactly 1 expected in ../web/themes/custom/rw/components/_twig-components/functions/pl_bamboo_load_currentuser.function.php:7
Stack trace:
#0 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Environment.php(497) : eval()'d code(101): PatternLab\PatternEngine\Twig\TwigUtil::{closure}()
#1 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Template.php(427): __TwigTemplate_cbf5d6a87d361cc7730e5eae5d8b6b1c7e920bb86d13afa1de36a8a43dcc5a8a->doDisplay(Array, Array)
#2 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src/Template.php(398): Twig\Template->displayWithErrorHandling(Array, Array)
#3 ../web/themes/custom/rw/pattern-lab/vendor/twig/twig/src in ../web/themes/custom/rw/components/_twig-components/functions/pl_bamboo_load_currentuser.function.php on line 7
Error with code 255 after running: php pattern-lab/core/console --generate

Any idea how to solve it?

Thanks for help.

sinyayadynya avatar Apr 19 '19 13:04 sinyayadynya

PS: for that project, I'm on Emulsify 2.7

sinyayadynya avatar Apr 19 '19 13:04 sinyayadynya