code: protected JSONObject getJSONConfig(
          CmsObject cms,
          A_CmsXmlContentValue schemaType,
          CmsMessages messages,
          CmsResource resource,
          Locale contentLocale) {
  
          JSONObject result = new JSONObject();
          try {
              for (Entry<String, String> paramEntry : getGalleryOpenParams(
                  cms,
                  messages,
                  schemaType,
                  cms.getSitePath(resource),
                  0).entrySet()) {
                  result.put(paramEntry.getKey(), paramEntry.getValue());
              }
              JSONObject additional = getAdditionalGalleryInfo(cms, cms.getSitePath(resource), messages, null);
              if (additional != null) {
                  result.merge(additional, true, true);
              }
              result.put(I_CmsGalleryProviderConstants.CONFIG_LOCALE, contentLocale.toString());
              result.remove(I_CmsGalleryProviderConstants.CONFIG_CURRENT_ELEMENT);
          } catch (JSONException e) {
              LOG.error(e.getMessage(), e);
          }
          return result;
      }
docs: Returns the gallery widget configuration as a JSON object.<p>
  
  @param cms the cms context
  @param schemaType the schema type
  @param messages the messages
  @param resource the edited resource
  @param contentLocale the content locale
  
  @return  the gallery widget configuration