Are you sure the assignment to $editorField is correct as $fields->fieldByName('Root.Main.HTML') targeting SilverStripe\Forms\FieldList::fieldByName() seems to always return null.
This check looks for function or method calls that always return null and whose
return value is assigned to a variable.