If you are doing this for a page, I assume you have a controller action for that page.
You can do this in your controller action:
namespace [Namespace]\[Module]\Controller\[Something];
class SomeAction extends \Magento\Framework\App\Action\Action
{
protected $resultPageFactory;
protected $scopeConfig;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
) {
$this->resultPageFactory = $resultPageFactory;
$this->scopeConfig = $scopeConfig;
parent::__construct($context);
}
public function execute()
{
$page = $this->resultPageFactory->create();
$layout = $this->scopeConfig->getValue(
'path/to/config_value',
\Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_STORE
);
if ($layout) {
$page->getConfig()->setPageLayout($layout);
}
}
}
I haven't tested the code, so watch out for typos.