Comments (2)
It's correct that this error with the afterSaveLabel
event occurs because of $label
not being set in the handleChangedLabel()
method. I'm honestly not sure what changed in Craft to trigger the bug. Anyway, it should be set to the FieldLabelModel
of the saved label, as it is with the beforeSaveLabel
event run at line 171 of src/Service.php
within saveLabel()
. Like this:
// Trigger an `afterSaveLabel` event
if ($this->hasEventHandlers('afterSaveLabel')) {
$label = new FieldLabelModel([
'id' => $record->id,
'fieldId' => $record->fieldId,
'fieldLayoutId' => $record->fieldLayoutId,
'name' => $record->name,
'instructions' => $record->instructions,
'hideName' => $record->hideName,
'hideInstructions' => $record->hideInstructions,
'uid' => $record->uid,
]);
$this->trigger('afterSaveLabel', new FieldLabelsEvent([
'label' => $label,
'isNewLabel' => $isNew,
]));
}
I've opened pull request #38 with this solution.
from craft-fieldlabels.
Hi.
Same error occurred in similar environment(Craft: 3.1.31, Field Label: 1.1.2, and Multi Site).
It seems can fix, like this:
// Trigger an `afterSaveLabel` event
if ($this->hasEventHandlers('afterSaveLabel')) {
$this->trigger('afterSaveLabel', new FieldLabelsEvent([
'label' => $data['name'], // only this line changed.
'isNewLabel' => $isNew,
]));
}
https://github.com/spicywebau/craft-fieldlabels/blob/master/src/Service.php#L261
Thanks!
from craft-fieldlabels.
Related Issues (20)
- 256-character limit for instructions column too small HOT 1
- Replace error message default value with field label's value
- [bug] Uncaught type errors and can't remove relabels
- PostgreSQL error with hideName column
- Unknown column 'hideName' in 'field list' after updating HOT 3
- Not working in 3.2.0 HOT 1
- Show new label in field tab HOT 3
- Not displaying new labels/instructions HOT 4
- Labels are only applied on first entry type HOT 2
- Deleting a relabeled field does not remove reference in project.yaml, making it crash on craft setup.
- Cannot revert multiple labels at once. HOT 2
- Re-labels not visible on “New Entry” pages in Craft 3.4 HOT 2
- Support site translations for relabel name and instructions HOT 2
- Unable to save changes to Neo field with relabels HOT 6
- Not displaying new labels/instructions for drafts in Craft 3.5 beta
- Transition to Craft 3.5 native relabelling HOT 4
- Cannot read property 'prototype' of undefined HOT 1
- Migration failure on update: Unknown column 'types.maxSiblingBlocks' in 'field list' HOT 1
- Craft 3.5.4 Migration issue HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from craft-fieldlabels.