LabelHandler will return an empty array if no label was attached to an object, which will result in undefined offset error in the LabelFormField
static::$loadedLabels[$objectTypeID] = [];
}
if (!isset(static::$loadedLabels[$objectTypeID][$objectID])) {
- static::$loadedLabels[$objectTypeID][$objectID] = LabelHandler::getInstance()->getAssignedLabels(
+ $assignedLabels = LabelHandler::getInstance()->getAssignedLabels(
$objectTypeID,
[$objectID]
- )[$objectID];
+ );
+ static::$loadedLabels[$objectTypeID][$objectID] = isset($assignedLabels[$objectID]) ? $assignedLabels[$objectID] : [];
}
$labelIDs = $this->getLabelGroup()->getLabelIDs();