Liferay 7.2 CE: enable custom keys for Widget Templates

thumbnail
Alessandro Candini, modified 6 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
Hi, what is the portal property in Liferay 7.2 CE that enables me to define a custom key for my Widget Templates, during their creation process?
I was able to do that in 6.2, but I don't find any reference to do it in 7.2.
I've the same problem with Web Content Structures and Web Content Templates.
Thank you.
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I think, you can find the checkboxes here:
Control Panel -> Configuration -> System Settings (Content and Data) -> Dynamic Data Mapping
Control Panel -> Configuration -> System Settings (Content and Data) -> Web Content -> Administration
Uncheck the autogenerate structure/template key checkboxes.
thumbnail
Alessandro Candini, modified 6 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
Thank you Christoph, that's correct!
As additional info, I've exported configuration files and put them inside osgi/configs directory of my application server:
  • com.liferay.dynamic.data.mapping.web.configuration.DDMWebConfiguration.config
    autogenerateStructureKey="false"
    autogenerateTemplateKey="false"
    changeableDefaultLanguage="false"
  • com.liferay.journal.web.configuration.JournalWebConfiguration.config
    autogenerateDDMStructureKey="false"
    autogenerateDDMTemplateKey="false"
    changeableDefaultLanguage="false"
    defaultDisplayView="descriptive"
    displayViews=[ \
      "icon", \
      "descriptive", \
      "list", \
      ]
    journalArticleForceAutogenerateId="true"
    journalArticlesSearchWithIndex="true"
    journalBrowseByStructuresSortedByName="true"
    journalDDMTemplateLanguageTypes=[ \
      "ftl", \
      ]
    journalFeedForceAutogenerateId="true"
    maxAddMenuItems="7"
    showAncestorScopesByDefault="false"
    showFeeds="false
thumbnail
Alessandro Candini, modified 5 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
I've just realized that the above configuration works only for Widget Templates...for Web Content Structures and Templates does not work and keys continue to be autogenerated. Any suggestions? Thank you
thumbnail
Alessandro Candini, modified 5 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
I've found that the configuration is correct, but probably Liferay has a bug.
In the images attached, you can see inside red rectangles what appears in the interface with the above configuration: a not resolved language key for structures and only a label for templates: in both cases no input text fields at all to set a custom key.
I've found a workaround with a groovy script, updating the structure/template key after their creation:
def structureName = "EXISTENT-STRUCTURE";
def newStructureKey = "NEW-KEY"; def query = "UPDATE DDMStructure SET structureKey='"+newStructureKey+"' WHERE name like '%"+structureName+"%';";
def result = com.liferay.portal.kernel.dao.db.DBManagerUtil.getDB().runSQL(query); 

and
def templateName = "EXISTENT-TEMPLATE";
def newTemplateKey = "NEW-KEY"; def query = "UPDATE DDMTemplate SET templateKey='"+newTemplateKey+"' WHERE name like '%"+templateName+"%';";
def result = com.liferay.portal.kernel.dao.db.DBManagerUtil.getDB().runSQL(query);
---
EDIT: I've opened a related bug to this.