Liferay 7.3: How to make menu items in a theme controlled by admin - liferay

I have a liferay theme for version 7.3. I am facing one problem in the theme's menu.
Now menu has some static items. How can I change (add / remove) items dynamically by admin account?
The menu is added in /src/templates/portal_normal.ftl as
<#include "${full_templates_path}/menu-bar.ftl" />
this file has static html data.
Now how can I make it dynamic so that admin can change the menu items?
Make the menu as a web content, and drag it to the theme? Not makes sense because menu is the part of the theme.
Or any other way of picking the menu items, looping the items in .ftl and display it?

The times of scripting navigation and menus in the theme are over, and I'd rather recommend to embed a portlet in your theme that does the job. That might be a stock NavigationMenu portlet (see how Liferay's default "classic theme" does this with NavigationMenu or the SearchBar), or a custom one, which generates exactly what you'd like.
Reason: It's a lot simpler to redeploy a new portlet and generate/test appropriate HTML markup generation in a portlet than it is to implement proper error handling in a theme's freemarker script.

The solution can be if you want to add your data in navigation menu in themes, go into the navigation menus inside site builder in menu and create a new menu by clicking + button on top right and name the menu. Then go into the pages inside site builder inside menu. There will be a + sign on public pages. Click that and add a page that you want to list. If you want to create a submenu then on the page that is created, create a subpage by clicking there + sign. The page will be child and will be shown as a sub menu in theme.

Related

Kentico 12: detect if an editable area contains any widgets

I'm building a site in Kentico 12 MVC and working on setting up content personalization. The normal way to do this is to add an editable area in the view:
<div>
#Html.Kentico().EditableArea("area1")
</div>
Then, in the CMS, the Page tab will show an empty area where the user can add a widget with personalized content.
The problem is that the content I want to personalize is located in my site's login box, which is a common element on every page, so I'd need to manually add a widget into the editable area on every page individually. But my site has over 300 pages, so that's totally impractical.
Is there a way from within my view model that I could check if the editable area has any widgets, and if it doesn't, output default content instead? I'm trying to see if there's an API method or something that would let me count the number of widgets inside an editable area, but I can't find anything in the documentation.
I guess you need to check with regex if Editable area html contains widget tag "<object type="widget" >"

Is it possible to attach event on the *opening* of the context menu?

I am developing a WebExtension and as you know it is impossible to inject content script on chrome://* pages and https://chrome.google.com/webstore/*. I have a buttons in a context menu and for correct UX I would like to drop my item from context menu on such protected page.
According to the documentation I can handle click on my context menu item, but looks like no way to check the url of the page on the moment of right mouse click without trying to inject content script into every page?
As a workaround I have a code that checks url after click to the menu item.

In Navigation, possibility for page as Parent Navigation Item for other pages?

Through the admin GUI I want to use a page as Parent Navigation Item for a set of other pages. Instead of a Container.
Is there a way to make this possible?
First, you would have to create a plugin that overrides the dropdown template, since Bootstrap doesn't have clickable dropdowns in the navbar by default.
Then you would want the plugin to override the navigation form to show the Link field when navItem.type is "container".
Lastly, your plugin would need its own getBootstrapNav function, preferably in a custom service, that would inject the link into the dropdown item.

Custom Navigation is visible on Pop up windows like add document etc in Sharepoint 2010

I have created a custom navigation in masterpage. I am facing an issue
as this navigation is also visible on pop up windows like add
document, add announcements etc. How can I make it visible only on
pages in site collection?
Too solve your problem
All you need to do to hide custom elements from the popup windows, add the s4-notdlg class to your custom element div:
In your case its Navigation
<div class=”custom-Navigation-class s4-notdlg”> <div>

"Navigate Up" issues in sharepoint 2010

If I am on page
http://mysite.com/first/second/third/Wiki/pages/home.aspx
and click the Navigate Up button I can see the following hierarchy (whis is correct):
Home - first - second - third - Wiki
But if I navigate up one step to
http://mysite.com/first/second/third/SitePages/Home.aspx
and click the Navigate Up button again the first subsite is not showing up.
Home - second - third - Home
I set the navigation settings to be identical on both sites but still the same issue/error.
How can I fix this?
Cheers
A few things you can try....
In your masterpage / page layout, find your SiteMapPath control. This has a property called ParentLevelsDisplayed. If you set it to -1 (the default) it should show all parent sites in the breadcrumb. Also, make sure that the SiteMapProvider is the same for both controls on both pages.
In your /second subsite, check whether or not the global navigation is set to inherit from its parent. This setting will affect how the breadcrumb is displayed, more on this [here].
Third (and this only applies to publishing sites), open the page layout that your Home.aspx page is referencing. Search for PlaceHolderTitleBreadcrumb. Lots of the OOTB layouts override this placeholder and construct their own breadcrumb. There is a great list [here] of all the layouts and their individual breadcrumb settings.
Hopefully this helps!

Resources