The breakthroughs came when Rick realised that the leg doesn't need to telescope up if it is folded away outside the folded table and when David identified hinges which allow the side extension flaps to fold flat on top of the table. Confused? OK let's do the pictures.
To stow the table, first the flaps fold up and over to lie flat on the table using a clever hinge identified by David who spotted one on a sewing machine table. These hinges lie flush with the table top. Now see the next diagram viewed from the side of the tableThe table top, hinged at A is lifted slightly (1) to allow the leg, hinged at B to temporarily drop to the floor (2) so the table can drop against the wall (3).
Neat or what?!