The pivotal step of nanoparticle functionalization for the preparation of functional and magnetic hybrid opal films