presseddigital / linkit

Linkit Plugin for Craft 4
Other
28 stars 18 forks source link

Linkit broken in the field manager on Craft 3.7.24 #92

Closed WHITE-developer closed 2 years ago

WHITE-developer commented 2 years ago

After upgrading to Craft 3.7.24 Linkit is broken when creating a new linkit/editing matrix that contains a linkit. Maybe more Craft bug as the method it fails on is there since 3.7.24.

Stacktrace:

TypeError: Argument 1 passed to craft\web\twig\variables\Cp::field() must be of the type string, null given, called in /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php on line 1511 and defined in /var/www/html/vendor/craftcms/cms/src/web/twig/variables/Cp.php:811
Stack trace:
#0 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1511): craft\web\twig\variables\Cp->field(NULL, Array)
#1 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\Cp), 'field', Array, 'method', false, false)
#2 /var/www/html/storage/runtime/compiled_templates/a8/a88875ff848c5c04847d660417c0351467b9c60bb34f91ea0c725071865d6618.php(893): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\Cp), 'field', Array, 'method')
#3 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1114): __TwigTemplate_1a2db112675ef298aa23b543d1c2ff87dacb5f004a3e97ae82e93402e275eb60->macro_field(Array)
#4 /var/www/html/storage/runtime/compiled_templates/18/184d2d9531848deefabd2e9c20b0395aaa38218564ccfd1121214a597e293752.php(54): twig_call_macro(Object(__TwigTemplate_1a2db112675ef298aa23b543d1c2ff87dacb5f004a3e97ae82e93402e275eb60), 'macro_field', Array, 26, Array, Object(Twig\Source))
#5 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_5fb2954de5540d96b3eec156e3c6d8648b91da5f2768be5472b576231b51b750->doDisplay(Array, Array)
#6 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#7 /var/www/html/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#8 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#9 /var/www/html/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#10 /var/www/html/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment->render('linkit/fields/_...', Array)
#11 /var/www/html/vendor/fruitstudios/linkit/src/fields/LinkitField.php(155): craft\web\View->renderTemplate('linkit/fields/_...', Array)
#12 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1511): fruitstudios\linkit\fields\LinkitField->getSettingsHtml()
#13 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(fruitstudios\linkit\fields\LinkitField), 'getSettingsHtml', Array, 'method', false, false)
#14 /var/www/html/storage/runtime/compiled_templates/20/20fd943c8ea3c456c9b2b90d0600d765509cc2c81214c1ffc94926a8ed647c2d.php(503): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(fruitstudios\linkit\fields\LinkitField), 'getSettingsHtml', Array, 'method')
#15 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_a002771103a8dd2d49ea39d7ec8e621586a6003ee4bc3ca02d3aa229f13016e6->doDisplay(Array, Array)
#16 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#17 /var/www/html/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#18 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#19 /var/www/html/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#20 /var/www/html/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment->render('_components/fie...', Array)
#21 /var/www/html/vendor/craftcms/cms/src/fields/Matrix.php(501): craft\web\View->renderTemplate('_components/fie...', Array)
#22 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1511): craft\fields\Matrix->getSettingsHtml()
#23 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\fields\Matrix), 'getSettingsHtml', Array, 'method', false, false)
#24 /var/www/html/storage/runtime/compiled_templates/2c/2c8b97c8e7cb6166f92f29cb0691963b2458367afe8911fb8e26d7b49ec6002c.php(46): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\fields\Matrix), 'getSettingsHtml', Array, 'method')
#25 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_0904ce931566993a0433efa422f1e855214391b19f86eac7e73ab9b4ffc352f9->doDisplay(Array, Array)
#26 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#27 /var/www/html/storage/runtime/compiled_templates/76/7640eba3a73a048b179dc75ec455357ce5d544ddbe01a30603ad4b0925991152.php(256): Twig\Template->display(Array)
#28 /var/www/html/vendor/twig/twig/src/Template.php(182): __TwigTemplate_34508e19d8e646bbda39586f600f55b4a3a1a4350686dc2f11bc3cca2c104148->block_content(Array, Array)
#29 /var/www/html/storage/runtime/compiled_templates/f2/f29e71cf450588ac6d92d11043e2e18b56d32f94bc6d62f61741b9c20951869c.php(535): Twig\Template->displayBlock('content', Array, Array)
#30 /var/www/html/vendor/twig/twig/src/Template.php(182): __TwigTemplate_b9abad11c1160a2ffda888dd65b36864476c33d33d9aa9015a7ead4976a67fad->block_main(Array, Array)
#31 /var/www/html/storage/runtime/compiled_templates/f2/f29e71cf450588ac6d92d11043e2e18b56d32f94bc6d62f61741b9c20951869c.php(346): Twig\Template->displayBlock('main', Array, Array)
#32 /var/www/html/vendor/twig/twig/src/Template.php(182): __TwigTemplate_b9abad11c1160a2ffda888dd65b36864476c33d33d9aa9015a7ead4976a67fad->block_body(Array, Array)
#33 /var/www/html/storage/runtime/compiled_templates/12/1294769d8246d299c6bbc4ca1cdf5906d0772359fc51c79fbd45f0de4498f0b6.php(96): Twig\Template->displayBlock('body', Array, Array)
#34 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_793e699b840fc26abff6ac898f4420175c52d02c830babbe36d2bf9d3e82a9c8->doDisplay(Array, Array)
#35 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#36 /var/www/html/storage/runtime/compiled_templates/31/312b6144f4d7a09dd3a838fb768a7091c7a2d24a32c49df531a410d45cf2cb67.php(56): Twig\Template->display(Array, Array)
#37 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_afa54fa65549d53a5c7219c09c95a798e04a60ab70106aa6e966ba52fb703aa6->doDisplay(Array, Array)
#38 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#39 /var/www/html/storage/runtime/compiled_templates/f2/f29e71cf450588ac6d92d11043e2e18b56d32f94bc6d62f61741b9c20951869c.php(165): Twig\Template->display(Array, Array)
#40 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_b9abad11c1160a2ffda888dd65b36864476c33d33d9aa9015a7ead4976a67fad->doDisplay(Array, Array)
#41 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#42 /var/www/html/storage/runtime/compiled_templates/76/7640eba3a73a048b179dc75ec455357ce5d544ddbe01a30603ad4b0925991152.php(114): Twig\Template->display(Array, Array)
#43 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_34508e19d8e646bbda39586f600f55b4a3a1a4350686dc2f11bc3cca2c104148->doDisplay(Array, Array)
#44 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#45 /var/www/html/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#46 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#47 /var/www/html/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#48 /var/www/html/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment->render('settings/fields...', Array)
#49 /var/www/html/vendor/craftcms/cms/src/web/View.php(461): craft\web\View->renderTemplate('settings/fields...', Array)
#50 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(201): craft\web\View->renderPageTemplate('settings/fields...', Array, 'cp')
#51 /var/www/html/vendor/craftcms/cms/src/controllers/FieldsController.php(258): craft\web\Controller->renderTemplate('settings/fields...', Array)
#52 [internal function]: craft\controllers\FieldsController->actionEditField(5, Object(craft\fields\Matrix), '3')
#53 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#54 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#55 /var/www/html/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('edit-field', Array)
#56 /var/www/html/vendor/craftcms/cms/src/web/Application.php(287): yii\base\Module->runAction('fields/edit-fie...', Array)
#57 /var/www/html/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction('fields/edit-fie...', Array)
#58 /var/www/html/vendor/craftcms/cms/src/web/Application.php(272): yii\web\Application->handleRequest(Object(craft\web\Request))
#59 /var/www/html/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#60 /var/www/html/web/index.php(21): yii\base\Application->run()
#61 {main}
heymarkreeves commented 2 years ago

I hit this today, too.

samhibberd commented 2 years ago

Thanks for covering this off @brandonkelly

Will have a look and see if anything can be improved our end, we use the field macro without an input to cp keep styling consistent.

brandonkelly commented 2 years ago

@samhibberd What exactly is the point of rendering a field without an input?

samhibberd commented 2 years ago

@brandonkelly by the looks of it we are using it as a heading to group multiple fields, and take advantage of the instructions and error params. All with a view to keep styling consistent.

No doubt there will be a better way to achieve this.

brandonkelly commented 2 years ago

Yeah… semantically a <label> is not a heading, which is a problem for screen readers, so it would be a good idea to fix that regardless. I’m not sure when the next Craft release is going to go out, so it’s probably a good idea to just fix this on Link It’s end.

siebird commented 2 years ago

@samhibberd any hot fixes for this?

ajp commented 2 years ago

@samhibberd @siebird From what I've been able to test, running Craft 3.7.24+ (tested individually at 3.7.24, .25, .26) the errors are no longer present, and I'm able to edit fields as expected.

samhibberd commented 2 years ago

Craft covered for this in 3.7.25, although we will address the label / heading stuff to help with screen readers, as mentioned by Brandon, in our next release (currently being tested).