public function TBMegaMenuAdminController::saveError in The Better Mega Menu 8
Same name and namespace in other branches
- 2.x src/Controller/TBMegaMenuAdminController.php \Drupal\tb_megamenu\Controller\TBMegaMenuAdminController::saveError()
Displays and logs an error when config can't be saved.
Parameters
string $event: The event that triggered the error.
string $menu_name: The machine name for the current menu.
string $theme: The machine name for the current theme.
array $block_config: The configuration for the current block.
array $menu_config: The configuration for the current menu.
Return value
string An error message displayed to the user.
3 calls to TBMegaMenuAdminController::saveError()
- TBMegaMenuAdminController::loadMenuBlock in src/
Controller/ TBMegaMenuAdminController.php - Loads a menu block.
- TBMegaMenuAdminController::loadMenuConfig in src/
Controller/ TBMegaMenuAdminController.php - Loads a menu configuration.
- TBMegaMenuAdminController::saveMenuConfig in src/
Controller/ TBMegaMenuAdminController.php - Saves a menu configuration.
File
- src/
Controller/ TBMegaMenuAdminController.php, line 223
Class
- TBMegaMenuAdminController
- Handler for configuring and saving MegaMenu settings.
Namespace
Drupal\tb_megamenu\ControllerCode
public function saveError(string $event, string $menu_name = NULL, string $theme = NULL, array $block_config = NULL, array $menu_config = NULL) {
$msg = $this
->t("TB MegaMenu error:");
switch ($event) {
case 'load_menu':
$msg .= ' ' . $this
->t("could not load the requested menu.");
break;
case 'load_config':
$msg .= ' ' . $this
->t("could not (re)load the requested menu configuration.");
break;
case 'load_block':
$msg .= ' ' . $this
->t("could not load the requested menu block.");
break;
case 'missing_info':
$problem = ($menu_name ? '' : "menu_name ") . ($theme ? '' : "theme_name ") . ($block_config ? '' : "block_config ") . ($menu_config ? '' : "menu_config");
$msg .= ' ' . $this
->t("Post was missing the following information: @problem", [
'@problem' => $problem,
]);
break;
default:
$msg .= ' ' . $this
->t("an unknown error occurred.");
}
return $msg;
}