[opencms-dev] OpenCms 11+ : ability to create namePattern without	%(number)
    Sandrine Prousteau 
    s.prousteau at eurelis.com
       
    Tue Sep 10 18:40:39 CEST 2019
    
    
  
> Hi
Is there a solution to associate a name-pattern to a custom xmlcontent type
without %(number)??
I need to create single files as ".mycustomconfig"...
I tried adding  "name-pattern" attribute in explorertypes definition, but
it generated errors in logs. Either in module .config ou sites .config...
I see that, if we don't define anything, the default name when we create a
file from the explorer view and "create new resource", is "new_[TYPENAME]",
without any "000001".
I found this function in CmsWorkplaceManager :
public String getDefaultNamePattern(String type) {
        CmsExplorerTypeSettings settings = getExplorerTypeSetting(type);
        if ((settings != null) && (settings.getNamePattern() != null)) {
            return settings.getNamePattern();
        }
        if (type.equals("sitemap_config") || type.equals("module_config")) {
            return ".config%(number)";
        }
        if (type.equals("content_folder")) {
            return ".content%(number)";
        }
        return "new_" + type + "%(number)";
 }
Why the default %(number) is replaced by nothing is this case, and by
numbers if we set the pattern manually?
It would be very useful to customise this!!!
Sandrine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20190910/71d1c73b/attachment.htm>
    
    
More information about the opencms-dev
mailing list