Note the "$mode"
switch ($mode) { case 'frontend':
as opposed to the 'config' mode, above.