Add hooks importTheme and exportTheme

As discussed in #7296 but I have changed the hook parameters.