function setPosition(modalName, position, layout) {
    if (modalName === PREFERENCES_MODAL_NAME) {
        if (layout === 'box') {
            disablePMPositionOptions(true);
        } else if (pmPositionOptionsDisabled) {
            disablePMPositionOptions(false);
        }
    }

    if (modalName === CONSENT_MODAL_NAME)
        generateCMPositionOptions(!layout.startsWith('bar'));

    htmlElements[modalName].position.value = position;
}
@param {'consentModal' | 'preferencesModal'} modalName
@param {string} position
@param {string} [layout]