Advanced content manager extension for Magento®
- a powerful CMS

Add ContentType in the setup data file

Maybe you need for your project to add some ContentType programmatically. Actually you can add ContentType, Content and ContentList programmatically, anywhere you want in your code.

In the example below, we explain how to add a ContentType while installing/upgrading your module.

First of all, initialize your Magento 2 module structure: http://devdocs.magento.com/guides/v2.1/extension-dev-guide/build/build.html
And don't forget to add Blackbird_ContentManager to your module dependencies.

Then add one of these classes, regarding what you need:

First install of the module:
<MyVendor>\<MyModule>\Setup\InstallData
Must implement \Magento\Framework\Setup\InstallDataInterface

Upgrade of the module:
<MyVendor>\<MyModule>\Setup\UpgradeData
Must implement \Magento\Framework\Setup\UpgradeDataInterface

For the version management, please see the references mentioned at <Magento2Root>/setup/src/Magento/Setup

Now in your setup file class, you should apply this: How to add Content programmatically?

100%
OpenSource

60 days
free support

Unlimited
updates

Made for developers
and webmasters

14 days money
back guarantee

Made by Magento
certified developers