It might be best to translate so that the reader understands that other people, perhaps Hilkiah and "the priests under him" ([2 Kings 23:4](../23/04.md)), might have helped Josiah do this. (See: [[rc://en/ta/man/translate/figs-explicit]])
Here "given" represents being dedicated for worship. Alternate translation: "had used to worship the sun" (See: [[rc://en/ta/man/translate/figs-metonymy]])