Plans to build a solar farm across 35 hectares of agricultural land in Wakefield have been given the go-ahead.