sulu / sulu-docs

Sulu documentation
https://docs.sulu.io
22 stars 116 forks source link

Document "Create Custom Content Type" #121

Open joemoe opened 8 years ago

joemoe commented 8 years ago

https://github.com/sulu-io/sulu/issues/451#issuecomment-147306832

SalvatorePollaci commented 7 years ago

Any updates on this? Thank you

danrot commented 7 years ago

No, there are no updates until now...

cioddi commented 7 years ago

Can you hint us on a sample implementation of a simple custom content type. Or which classes, template and config files are required to get it done and how to correctly register it to the sulu cms system.

If I look at SingleInternalLink (choose it to avoid naming collisions when searching through the whole project). I can find the following files:

wachterjohannes commented 7 years ago

There are 4 points you have to do.

  1. Create a tagged service (sulu.content.type) which implements the ContentTypeInterface or extend SimpleContentType.
  2. Create an aura-component which implements the UI for the ContentType (see vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/Resources/public/js/components/single-internal-link/main.js)
  3. Create a data-type (see vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/Resources/public/js/validation/types/singleInternalLink.js)
  4. Create a template (see vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/Resources/views/Template/content-types/single_internal_link.html.twig) which starts the component.
alexander-schranz commented 7 years ago

Example implementation can be found here: https://github.com/sulu/ExampleNewsBundle/pull/14

niklasnatter commented 3 years ago

An example implementation for Sulu 2.0 is available in the sulu-demo repository: https://github.com/sulu/sulu-demo/pull/66