Add PHP API for contextual panels/sections (props @celloexpressions), along with JS one

For Trac 29758