Wow. What a mission... 😓
The thing is I needed to check if a JavaScript block with a type attribute would be accepted first, as I will be adding JS to the page in some cases.
This would then confirm to me that I can then adjust the script block type attribute and try Google Schema afterwards as a test, which does require "type".
When the type attribute kept on being stripped out on my "does it accept Javascript type attribute with javascript/text" test, I kept on trying to fix it and was sent on this long mission...
Phew. Thanks for the clarification and patience.
My next question is why does your CMS accept the script tag without (I presume) changes to the Classes/Validate.php file?
And also, for anyone reading this thread:
The caveat or note with this solution is that it Nukes / deletes all Features pertaining to this product - and not just the ones that you're updating.
This means that you will need to 'replace' all the product's features when doing an update - you can't just do an update on one feature only.
So if you have 4 features on a product and only want to update 1, then you will need to remember to include all 4 features, and not just one in the CSV import when doing an update.
If you only have one feature, then it will delete the other 3, and only import 1.
This entire solution is geared to adding "updating feature values" with CSV Import to this free module (the module enables TB to have features with multiple values). https://github.com/jdanthinne/advancedfeaturesvalues
If you're not using this module or do not need to update features with multiple values using CSV Import, then this solution is not necessary, as TB updates feature values (one value per feature) on import without needing to change any code. It's just with "multiple values per feature" that there is a problem.
However, if you are using this module and need to update feature values when doing a CSV import,
in \controllers\admin\AdminImportController.php file:
you need to add the following (the part in bold) just after "if (!$validateOnly && isset($features['features']) && !empty($features['features'])) {"
// Features import
$features = get_object_vars($product);
if (!$validateOnly && isset($features['features']) && !empty($features['features'])) {
if ($forceIds || $matchRef) {
$product->deleteFeatures();
}
This deletes the target product's features and replaces it with what is specified in the CSV.
Full credit to @Jonny for the solution to this problem, obviously 🙂