Add contexts as class to layout form.

From #2867.