I doubt your solicitor really knows what they are talking about unless they specialise in agricultural estates, which is whole legal and accounting area of its own.
Your first port of call should be to a specialist, not a regular family law solicitor. You will also need proof of your contributions and to demonstrate how they gave you a beneficial interest in the property going forward (we would have to be talking about a sizeable investment, not just the equivalent of rent and bills)
It will all hinge on how much and how long - the next complexity is that a court will probably side with the farmer in any attempt to force a sale of land, as it will be argued that will impact the business.
You have no legal interest in the farm whatsoever - that is (from your information) fact, you are claiming beneficial interest, which will require proof, and in such a circumstance that bar will be set quite high.
Traditionally such matters might be resolved by granting you life tenancy on an estate property for a peppercorn rent - and that remains a likely resolution that a court would accept.
Bear in mind that getting this to court will be all at your expense, and that will be a LOT of money - far better to agree something that works rather than risking a massive legal bill and loosing the case.