docs: public static void initGallery(CmsDialog wp) {
  
          // 1. get "gallerytypename" by reading the folderpath
          String galleryTypeName = null;
          if (wp.useNewStyle()) {
              galleryTypeName = CmsResource.getName(CmsResource.getFolderPath(wp.getAdminTool().getHandler().getLink()));
          } else {
              galleryTypeName = CmsResource.getName(CmsResource.getFolderPath(wp.getJsp().getRequestContext().getUri()));
          }
          if (galleryTypeName.endsWith("/")) {
              galleryTypeName = galleryTypeName.substring(0, galleryTypeName.length() - 1);
          }
          if (!galleryTypeName.equals("commons")) {
              // 2. set in user settings
              wp.getSettings().setGalleryType(galleryTypeName);
          }
      }