Publicador de Conteúdos e Mídias

COMPARTILHAR

Menu Exibir

COMPARTILHAR

Um erro ocorreu enquanto processava o modelo.
The following has evaluated to null or missing:
==> portletPreferences.getValue  [in template "30648863014451#20119#3027012" at line 16, column 37]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: parentPageId = getterUtil.getLong(por...  [in template "30648863014451#20119#3027012" at line 16, column 3]
----
1<#--  
2  Template para Menu Exibir (Navigation Menu) 
3  Exibe apenas os filhos diretos de uma página específica selecionada manualmente 
4--> 
5 
6<#--  
7  Para usar este template: 
8  1. Crie um modelo em Site Administration > Design > Page Templates > Navigation Menu 
9  2. Copie e cole este código 
10  3. Nas configurações do portlet Navigation Menu, selecione este template 
11  4. Configure a preferência "parentLayoutId" com o ID da página pai desejada 
12--> 
13 
14<#-- Configurações --> 
15<#assign  
16  parentPageId = getterUtil.getLong(portletPreferences.getValue("parentLayoutId", "0")) 
17  cssClass = "children-only-menu" 
18/> 
19 
20<#-- Se não houver ID configurado, mostre uma mensagem --> 
21<#if parentPageId == 0> 
22  <#if themeDisplay.isSignedIn()> 
23    <div class="alert alert-info"> 
24      <p>Para configurar este menu:</p> 
25      <ol> 
26        <li>Clique no ícone de configuração (⚙️) deste portlet</li> 
27        <li>Vá para a aba "Configuração da Portlet" ou "Preferências"</li> 
28        <li>Adicione uma preferência com nome "parentLayoutId" e valor igual ao ID da página pai</li> 
29      </ol> 
30    </div> 
31  </#if> 
32<#else> 
33  <#-- Obter serviço de Layout --> 
34  <#assign layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") /> 
35   
36  <#-- Buscar filhos diretos da página especificada --> 
37  <#assign childLayouts = layoutLocalService.getLayouts(themeDisplay.getScopeGroupId(), false, parentPageId) /> 
38   
39  <#if !childLayouts?has_content> 
40    <#if themeDisplay.isSignedIn()> 
41      <div class="alert alert-info"> 
42        <@liferay.language key="there-are-no-menu-items-to-display" /> 
43      </div> 
44    </#if> 
45  <#else> 
46    <div aria-label="<@liferay.language key="site-pages" />" class="${cssClass}"> 
47      <ul class="nav-menu"> 
48        <#list childLayouts as layout> 
49          <#assign isSelected = (themeDisplay.getLayout().getLayoutId() == layout.getLayoutId()) /> 
50           
51          <li class="nav-item ${isSelected?string('active', '')}"> 
52            <a href="${layout.getFriendlyURL()}" class="nav-link"> 
53              ${layout.getName(locale)} 
54            </a> 
55          </li> 
56        </#list> 
57      </ul> 
58    </div> 
59     
60    <#-- CSS Básico --> 
61    <style> 
62    .${cssClass} { 
63      margin: 1rem 0; 
64
65    .${cssClass} .nav-menu { 
66      list-style: none; 
67      padding-left: 0; 
68      margin: 0; 
69
70    .${cssClass} .nav-item { 
71      margin-bottom: 0.5rem; 
72
73    .${cssClass} .active > a { 
74      font-weight: bold; 
75      color: #0b5fff; 
76
77    </style> 
78  </#if> 
79</#if>