Open Closed

How to add in extraProperties in pages in CMS #3898


User avatar
0
Merna created

Hello, I have a new business requirement , So I need to add in extra properties in CMS Module in pages table Is there a way to customize it by using ModuleExtentionConfiguration (like I can customize Identity). In this way I am able to define the extra properties and framework will take care of adding them to the APIs and UI as well.

Here is some information about my application

ABP Framework version: v5.1

UI type: MVC

DB provider: EF Core


7 Answer(s)
  • User Avatar
    0
    malik.masis created

    Hello Merna,

    As far as I understand, the tables already contain the ExtraProperties row in the cms module tables. AggregateRoot implementers IHasExtraProperties so you can use that (more)

    Please, give us more detail if the answer isn't clear.

    Regards.

  • User Avatar
    0
    Merna created

    Hello , Yes, I know I can use extra properties. But my question. Is there a way to customize it by using ModuleExtentionConfiguration (like I can customize SaaS module entities Tenant and Edition). In this way I'll be able to define the extra properties and framework will take care of adding them to the APIs and UI as well.

    But for Cms module I can't find .Configuration or similar extension. There is generic .ConfigureModule extension but it requires the type ModuleExtensionConfiguration for the action. for example :

  • User Avatar
    0
    malik.masis created

    Hello,

    The module must be developed with the Module Entity Extensions system in mind. All the official modules support this system wherever possible. more

    Also, you can generate a YourModuleExtensionConfiguration by inheriting from ModuleExtensionConfiguration.

    There is no direct method for CmsKitModule.
    It requires the type ModuleExtensionConfiguration for the action. You're right.

    Regards

  • User Avatar
    0
    mattw@agilenova.com created

    Hello,

    The module must be developed with the Module Entity Extensions system in mind. All the official modules support this system wherever possible. more

    Also, you can generate a YourModuleExtensionConfiguration by inheriting from ModuleExtensionConfiguration.

    There is no direct method for CmsKitModule.
    It requires the type ModuleExtensionConfiguration for the action. You're right.

    Regards

    Hello,

    I have a similar requirement. I wish to extend the CmsKitModule by adding extra properties. Is adding the Module Extension Configuration in the product roadmap for a future release (and, if so, when)?

    Thanks

  • User Avatar
    0
    malik.masis created

    Hello,

    The team says, there is no roadmap for this feature for CmsKit Module. FYI

    Regards.

  • User Avatar
    0
    mattw@agilenova.com created

    Due to the restriction above, I am trying to add a Language (extra) property to the CMS Page object. Please confirm the steps:

    1. I added the extra property in the AppDomainModule: ObjectExtensionManager.Instance .AddOrUpdate<Page>(options => { options.AddOrUpdateProperty<string>("Language", options => { options.DefaultValue = "en"; }); } );
    2. I mapped the property to a column in AppEfCoreEntityExtensionMappings ObjectExtensionManager.Instance .AddOrUpdateProperty<Page, string>( "Language", options => { options.MapEfCore(b => b.HasMaxLength(10)); } );
    3. I created and ran the migration successfully to add the Language column to the CmsPage table
    4. I copied the Razor / Admin pages from the CmsKit source code (retrieved using get-source) and copied into my Web project's Pages/CmsKit/Pages folder and renamed the model classes and updated the @model to reference the new class names
    5. I customized the .cshtml views to include the new Language field.

    How do I update the services and DTOs to return the updated Page/PageDto with the new field? I was thinking of trying CreateMap<Page, PageDto>().MapExtraProperties(); but I get a compile time error: The type 'Volo.CmsKit.Admin.Pages.PageDto' must be convertible to 'Volo.Abp.Data.IHasExtraProperties' in order to use it as parameter

    Please advise on next steps to allow CmsKit to support an extra property in the Page object. Thanks!

  • User Avatar
    0
    malik.masis created

    Hi Matt,

    Could you please check whether you inherited ExtensibleEntityDto or not to PageDto?

    I know you have looked at it here, but could you look at it again, please?

    MapExtraPropertiesTo is an extension method provided by the ABP Framework to copy extra properties from an object to another in a controlled manner

    Regards.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11