You should start the dish the day before. (Actually, two days before is better, as the soup is better the day after it's made.) Soak the dried beans overnight.
If using the pig's foot, simmer it with the aromatics and pinch of salt until it's falling off the bone. Let the pig's foot cool off and place in the fridge overnight.
The next day, take the pig's foot out of the fridge and skim off the considerable excess fat that will have risen to the top. Remove the pig's foot and careful peel off the skin with a boning knife and cut it into very small cubes and set aside. Cut off any meat as well and cut that, too, into small pieces and reserve separately.
Heat up the pork broth, pour it through a sieve, and set aside.
Simmer the dried beans with the garlic until they are about 3/4 of the way done, still a bit crunchy. Drain the beans.
Now, cut the fresh vegetables up and set out everything you'll need for the soup.
Begin the final cooking pouring a generous amount of olive oil in the bottom of a pot large enough to hold all the ingredients. Ideally, the pot will be made of terra-cotta, but a large enameled cast iron pot, or simply a stock pot, will do fine. Sauté the flavor base ingredients together until they soften. Add the tomatoes and continue cooking until the tomatoes have melted.
Add the parboiled dried legumes and give them a turn with the flavor base so everything is well coated. Now do the same with the fresh legumes and fresh vegetables. Add the degreased pork broth and, if you need it, enough water to cover. (If you're not using the pig's foot, just use water or broth.) Simmer until everything is nice and tender, about 45 minutes to an hour.
Towards the end of cooking add the chopped pork meat (if using) and, if you like, a handful of basil, mint and/or other fresh herbs to brighten the dish. If you have time, let the soup rest overnight and reheat the next day.
If using pasta, cook it separately until quite al dente, and add it to the pot a few minutes before you are ready to serve.
Serve with grated pecorino on the side for those who like it.