enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
200 stars 34 forks source link

lib-content.getSiteConfig is unable to return project config like lib-portal.getSiteConfig does #10431

Closed ComLock closed 6 months ago

ComLock commented 6 months ago

This is at least reproduceable inside a Guillotine 7.0.3 Extension

Keep in mind that a project can't be published, so project "siteConfig" should always be fetched from draft.

const libPortalSiteOrProjectConfig = libPortalGetSiteConfig();
log.info('contentMetaFieldsResolver branch:%s _path:%s libPortalSiteOrProjectConfig:%s', branch, _path, toStr(libPortalSiteOrProjectConfig));

const libContentSiteOrProjectConfig = libContentGetSiteConfig({
    applicationKey: app.name,
    key: _path
});
log.info('contentMetaFieldsResolver branch:%s _path:%s libContentSiteOrProjectConfig:%s', branch, _path, toStr(libContentSiteOrProjectConfig));
rymsha commented 6 months ago

This is by design. There is a libProject allows to reach config https://developer.enonic.com/docs/xp/stable/api/lib-project#get

rymsha commented 6 months ago

Keep in mind that a project can't be published, so project "siteConfig" should always be fetched from draft.

This is also not exactly true. Project is published with any published content within that project This is because applications and their configurations are inherited by layers where publishing cannot be propagated - layer may have changed config - added/removed apps, etc.

ComLock commented 6 months ago

There is a libProject allows to reach config https://developer.enonic.com/docs/xp/stable/api/lib-project#get

I'll have to test that. The documentation doesn't show that siteConfig is returned?

Only that you can affect it with create and modify.

BTW: Does lib-project.get read siteConfig from draft?