1

I want all the static pages on my website to have an image at the top of them. So instead of using Drupal's Basic Page type, I created my own type (Simple Page) that has:

  • Title
  • Body
  • Image

I have enabled Webform module on my site and created a simple Contact Us form.

The problem I have is that the Contact Us page (a Webform) does not have an image at the top, like all my other pages. To fix this, I edited the webform content type and added an Image field, and now my Contact Us page follows the styling of the other pages.

But it feels wrong, editing the Webform type directly. (Its as if I have hacked core!) And now I am worried that I'll have problems when I upgrade the Webform module.

Is there a better way that I could have done this?

2 Answers 2

2

I don't think you've necessarily done anything wrong by adding fields to the Webform content type, but if you're interested in strictly keeping your code separate from core code, you can create a new content type, and enable Webforms to be used on this content type under "Webform-enabled content types" on /admin/config/content/webform.

Then you'll be able to add your own image field to your own content type without problems. This will then leave you free to export the content type configuration to code with the features module, without really interfering with the Webform content type provided by the Webform module.

1

It is perfectly ok to do that.

The content type is provided by the webform module but changing it's configuration is not like hacking the code of a module.

When you do module updates for the webform module you won't lose any changes you have made to that content type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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