ToSic.SexyContent.ContentBlocks.EntityContentBlock._constructor C# (CSharp) Méthode

_constructor() private méthode

private _constructor ( IContentBlock parent, IEntity cbDefinition ) : void
parent IContentBlock
cbDefinition IEntity
Résultat void
        private void _constructor(IContentBlock parent, IEntity cbDefinition)
        {
            Parent = parent;
            ParseContentBlockDefinition(cbDefinition);
            ParentId = parent.ParentId;
            ContentBlockId = -cbDefinition.EntityId; // "mod:" + ParentId +  "-ent:" + cbDefinition.EntityId;

            // Ensure we know what portal the stuff is coming from
            PortalSettings = Parent.App.OwnerPortalSettings;

            ZoneId = Parent.ZoneId;

            AppId = AppHelpers.GetAppIdFromGuidName(ZoneId, _appName); // should be 0 if unknown, must test

            if (AppId == Settings.DataIsMissingInDb)
            {
                _dataIsMissing = true;
                return;
            }

            if (AppId != 0)
            {
                // try to load the app - if possible
                App = new App(ZoneId, AppId, PortalSettings);
                ContentGroup = App.ContentGroupManager.GetContentGroupOrGeneratePreview(_contentGroupGuid, _previewTemplateGuid);

                // handle cases where the content group is missing - usually because of uncomplete import
                if (ContentGroup.DataIsMissing)
                {
                    _dataIsMissing = true;
                    App = null;
                    return;
                }

                // use the content-group template, which already covers stored data + module-level stored settings
                Template = ContentGroup.Template;

                // maybe ensure that App.Data is ready
                App.InitData(SxcInstance.Environment.Permissions.UserMayEditContent, Data.ConfigurationProvider);
            }
        }