0

I'm creating a page "from scratch", with routing, controller, etc. The content of my page is created by code, buy I want to add a editable component (the description of the page).

I don't want to use blocks, because I don't wanto to give too many permissions to editor role.

I could create a "custom content" content type to store content and then add node content from code.

Other ways? I was thinking to use configurations, but if I export all configurations with "drush cex", this config will be overridden after editing. A good way could, if it's possibile, to exclude this single component from export.

Other ideas?

1
  • I always check this site of the drupal documentation when I am unsure which type of information I need: drupal.org/node/2120523 – Maouna Jul 11 '16 at 10:47
2

I am not sure about what is the question here. In general:

If you want to store content, create a ContentEntityType that extends ContentEntityBase. If you want to create a configuration, create a ConfigEntityType that extends ConfigEntityBase.

What you need sounds like a ContentType where you create your main content by code and have another Form to add/modify the content of a "page description" field in the ContentType. Maybe you can also use "Node" that could save a lot work.

1
  • Yes, a custom content entity could be the solution, thanks. I've to check how to add a "machine name" to these entities. – arrubiu Jul 11 '16 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.