Photons can be emitted in two ways.
a) charged particles change dp/dt in the field of other charged particles and the energy goes into photons. This spectrum is a continuum and for a given temperature is the characteristic black body radiation.
b) the atoms are in bound lattice states in a solid. Energy transfers can excite and de-excite from energy levels and these will have quantized energy lines, characteristic of the atoms or the lattice. The black body spectrum from a solid comes from the vibrational and rotational levels and the motion of the atoms in the spill over electric fields.
say we have gaseous iron and solid one, heated to a high degree. The mechanism by which they both produce light is similar: electrons drop from higher orbits and emit photons.
This is one of the two ways of photons being generated .
Gaseous iron will have both forms of photon generation: a black body spectrum , the atoms having a kinetic energy characterizing the radiation. The scattering of atoms against each other's spill out electric fields will contribute to this. For temperatures in the plasma regime the ions and electrons will contribute to the continuum spectrum.If the random scatterings excite electrons from the atomic bound states, the de-excitations give the characteristic iron lines.
Solid iron will have the rotational and vibrational states giving off the black body radiation and in addition, if some atoms are excited, the spectral lines will also appear, but at temperatures where iron is solid in a lattice, these lines will have small probability of appearing because not enough energy is available ( see black body spectrum).