contao/import — Issue #2826: Prohibit multiple fallback languages per domain
Author: aschempp
Created: 2011-11-29 20:21:29+00:00
State: open
Labels: backend, Feature

Beginners often check the "fallback language" checkbox multiple times per domain (for each root page). I think we could solve this issue by adding a save_callback and deny it.

**Concept:**

```
$GLOBALS['TL_DCA']['tl_page']['fields']['fallback']['save_callback'][] = array('tl_page', 'prohibitMultipleFallbacks');

function prohibitMultipleFallbacks($varValue, $dc)
{
$objPage = $this->Database->prepare("SELECT id FROM tl_page WHERE type='root' AND fallback='1' AND dns=?")->execute($dc->activeRecord->dns);

if ($objPage->numRows)
{
throw new Exception('You can only have one fallback per domain.');
}

return $varValue;
}

```

Related issues: #2950

--- _Originally created on January 26th, 2011, at 06:07pm (ID 2826)_