madebyraygun / craft-component-library

Craft CMS Plugin for Component Library
MIT License
4 stars 0 forks source link

Using a dot in the component name causes a PHP error #34

Open daltonrooney opened 2 months ago

daltonrooney commented 2 months ago

This is different than #33. If you define the component name or one of the variant names to include a dot, a PHP error is generated.

return [
    'name' => 'h1.heading-1',
    'context' => [
      ...
    ]
];
yii\base\ErrorException: Undefined array key "type" in /var/www/html/craft/vendor/madebyraygun/component-library/src/helpers/Library.php:59
Stack trace:
#0 /var/www/html/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\base\ErrorHandler->handleError(2, 'Undefined array...', '/var/www/html/c...', 59)
#1 /var/www/html/craft/vendor/madebyraygun/component-library/src/helpers/Library.php(59): craft\web\ErrorHandler->handleError(2, 'Undefined array...', '/var/www/html/c...', 59)
#2 /var/www/html/craft/vendor/madebyraygun/component-library/src/helpers/Library.php(68): madebyraygun\componentlibrary\helpers\Library::flattenTree(Array)
#3 /var/www/html/craft/vendor/madebyraygun/component-library/src/helpers/Library.php(68): madebyraygun\componentlibrary\helpers\Library::flattenTree(Array)
#4 /var/www/html/craft/vendor/madebyraygun/component-library/src/helpers/Library.php(50): madebyraygun\componentlibrary\helpers\Library::flattenTree(Array)
#5 /var/www/html/craft/vendor/madebyraygun/component-library/src/controllers/BrowserController.php(32): madebyraygun\componentlibrary\helpers\Library::getSearchIndexFromTrees(Array)
#6 [internal function]: madebyraygun\componentlibrary\controllers\BrowserController->actionIndex()
#7 /var/www/html/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#8 /var/www/html/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#9 /var/www/html/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('', Array)
#10 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(340): yii\base\Module->runAction('component-libra...', Array)
#11 /var/www/html/craft/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('component-libra...', Array)
#12 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(308): yii\web\Application->handleRequest(Object(craft\web\Request))
#13 /var/www/html/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#14 /var/www/html/public/index.php(26): yii\base\Application->run()
#15 {main}