0

I tried to create some fields and field instance programmatically in .install file.

And I need to set a specail field instance with display none.

I have google, but got nothing.

Does anyone have a solution ?

0

your question is not very clear.

What do you mean "display none"?

  • Make your field in the .install file.
  • Add a CSS file to your module info filefiles[]=mymodule.css
  • in the CSS file of your module .field-myfield {display:none;}.
  • clear your drupal cache

EDIT

I think you probably want to look at Field Permissions module.

The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.

  • "display none" is mean in the entity "MANAGE DISPLAY" page config the field "FORMAT" with the value "<Hidden>". – Rylyn Jul 10 '13 at 5:08
  • Field instance settings per content type can be Exported and managed in code when using the Features module. see drupal.org/project/features. Export the field to a Feature -- and examine how it sets up the $field_config and $field_instance_config in mymodule.features.field.inc – tenken Jul 10 '13 at 6:20

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.