public function WeMegaMenuAdminController::resetConfigWeMegaMenu in Drupal Mega Menu 8
Same name and namespace in other branches
- 8.x src/Controller/WeMegaMenuAdminController.php \Drupal\we_megamenu\Controller\WeMegaMenuAdminController::resetConfigWeMegaMenu()
A function reset menu config.
1 string reference to 'WeMegaMenuAdminController::resetConfigWeMegaMenu'
File
- src/
Controller/ WeMegaMenuAdminController.php, line 102
Class
- WeMegaMenuAdminController
- Controller routines for block example routes.
Namespace
Drupal\we_megamenu\ControllerCode
public function resetConfigWeMegaMenu() {
if (isset($_POST['action']) && $_POST['action'] == 'reset' && isset($_POST['menu_name']) && isset($_POST['theme'])) {
$theme_array = WeMegaMenuBuilder::renderWeMegaMenuBlock($_POST['menu_name'], $_POST['theme']);
$markup = render($theme_array);
echo $markup;
we_megamenu_flush_render_cache();
exit;
}
if (isset($_POST['action']) && $_POST['action'] == 'reset-to-default' && isset($_POST['menu_name']) && isset($_POST['theme'])) {
$query = \Drupal::database()
->delete('we_megamenu');
$query
->condition('menu_name', $_POST['menu_name']);
$query
->condition('theme', $_POST['theme']);
$result = $query
->execute();
WeMegaMenuBuilder::initMegamenu($_POST['menu_name'], $_POST['theme']);
$theme_array = WeMegaMenuBuilder::renderWeMegaMenuBlock($_POST['menu_name'], $_POST['theme']);
$markup = render($theme_array);
echo $markup;
we_megamenu_flush_render_cache();
exit;
}
exit;
}