。
Hearing the news of her son's accident, she was beside herself with grief, almost out of her mind.
Literal
She [topic-は] son [genitive-の] accident [genitive-の] news [object-を] heard-and grief [out-of-で] mind-also nearly-going-mad was.
気も狂わんばかりだった is a vivid literary expression. 気が狂う ('go mad, lose one's mind') is the base; the も substitutes for が for emphatic effect ('even one's mind'). ~んばかり is a classical pattern meaning 'almost / on the verge of doing X,' built on the negative ぬ-stem of a verb + ばかり. Together: 'as if even her mind was about to go.' The で in 悲しみで is the cause/source-of-emotion で. Grief-induced loss of composure is a recurring trope in Japanese literature, and this sentence has the polished, somewhat melodramatic feel of fictional prose.