Commit 63c1824c authored by Igor Biki's avatar Igor Biki
Browse files

ISTWCMS-5009: Adding contact/profile menu item.

parent 996b176d
...@@ -67,6 +67,20 @@ function uw_sites_all_install() { ...@@ -67,6 +67,20 @@ function uw_sites_all_install() {
function _uw_sites_all_get_menu_items(): array { function _uw_sites_all_get_menu_items(): array {
return [ return [
'Contacts' => [
'title' => 'Contacts',
'menu_name' => 'main',
'route_name' => 'view.uw_view_contacts.contact_page',
'weight' => 40,
'enabled' => TRUE,
],
'Profiles' => [
'title' => 'Profiles',
'menu_name' => 'main',
'route_name' => 'view.uw_view_profiles.profile_page',
'weight' => 45,
'enabled' => TRUE,
],
'Blog' => [ 'Blog' => [
'title' => 'Blog', 'title' => 'Blog',
'menu_name' => 'main', 'menu_name' => 'main',
...@@ -92,7 +106,7 @@ function _uw_sites_all_get_menu_items(): array { ...@@ -92,7 +106,7 @@ function _uw_sites_all_get_menu_items(): array {
'title' => 'Catalogs', 'title' => 'Catalogs',
'menu_name' => 'main', 'menu_name' => 'main',
'route_name' => 'view.uw_view_news_items.news_page', 'route_name' => 'view.uw_view_news_items.news_page',
'weight' => 60, 'weight' => 65,
'enabled' => FALSE, 'enabled' => FALSE,
], ],
]; ];
...@@ -250,3 +264,28 @@ function uw_sites_all_update_8107() { ...@@ -250,3 +264,28 @@ function uw_sites_all_update_8107() {
\Drupal::service('module_installer')->uninstall($modules); \Drupal::service('module_installer')->uninstall($modules);
} }
/**
* Recreate main menu items.
*/
function uw_sites_all_update_8108(&$sandbox) {
// Get the menu items.
$menu_items = _uw_sites_all_get_menu_items();
// Step through each menu item and create a menu link.
foreach ($menu_items as $menu_item) {
// Create the URL from the route name.
$url = URL::fromRoute($menu_item['route_name'])->toString();
// Create the actual menu link.
MenuLinkContent::create([
'title' => $menu_item['title'],
'link' => ['uri' => 'internal:' . $url],
'menu_name' => $menu_item['menu_name'],
'weight' => $menu_item['weight'],
'enabled' => $menu_item['enabled'],
])->save();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment