You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FYI @lindseydiloreto moved this here from our conversation in Craft Discord
I'm experiencing a bug on 4.0.0 whereby the Spoon button is not added to the field settings slideout on the field layout view, meaning that I can't configure per-field layout settings for Spoon.
I traced the issue to a bug in the JavaScript logic that decides whether to inject the Spoon button. Essentially the logic looks for a stringified ID value in an array of integer IDs, which always fails.
Fixing this in JS is super easy... The thing that's bothering me is why this is only happening for me, and apparently not for you/others. The only thing I could think of was difference PHP versions, though there's nothing relevant that I can see mentioned in the PHP 8.1 release notes.
Installed versions:
Craft 4.2.5.2
Spoon 4.0.0
PHP version 8.1.8
MySQL 10.3.35
Full debugging info below.
This is the current doublesecretagency\spoon\services\Field::getMatrixFieldIds()
publicfunctiongetMatrixFieldIds(): array
{
// If array of IDs is emptyif (!$this->_matrixFieldIds) {
// Populate array of IDs$this->_matrixFieldIds = (newQuery())
->select(['id'])
->from('{{%fields}}')
->where('type = :type', [':type' => 'craft\fields\Matrix'])
->column();
}
// Return array of Matrix field IDsreturn$this->_matrixFieldIds;
}
The id col of the fields table is of type int, so this method should always be returning an array of ints already
Over in Configurator.js we have (inline comments added):
// Add "Spoon" button to slideout
handleCreateSettings: function(ev){varfield=ev.target.$container[0];varid=$(field).data('id');// <--- jQuery.data coerces this to an int for us// If no ID exists, bailif(!id){return;}// If not a matrix field, bail// this check should always *fail* because we should be comparing a string against an array of intsif(this.settings.matrixFieldIds.indexOf(id.toString())===-1){return;}// ...}
FYI @lindseydiloreto moved this here from our conversation in Craft Discord
I'm experiencing a bug on
4.0.0
whereby the Spoon button is not added to the field settings slideout on the field layout view, meaning that I can't configure per-field layout settings for Spoon.I traced the issue to a bug in the JavaScript logic that decides whether to inject the Spoon button. Essentially the logic looks for a stringified ID value in an array of integer IDs, which always fails.
Fixing this in JS is super easy... The thing that's bothering me is why this is only happening for me, and apparently not for you/others. The only thing I could think of was difference PHP versions, though there's nothing relevant that I can see mentioned in the PHP 8.1 release notes.
Installed versions:
4.2.5.2
4.0.0
8.1.8
10.3.35
Full debugging info below.
This is the current doublesecretagency\spoon\services\Field::getMatrixFieldIds()
The
id
col of the fields table is of typeint
, so this method should always be returning an array ofint
s alreadyOver in
Configurator.js
we have (inline comments added):The only other place I can see this data getting transformed is here in the Loader service
The text was updated successfully, but these errors were encountered: