4

I am adding field inside module.install file to specified entity. I want to hide this field from display. How can I do that?

6

Anyway found solution, example of field instance:

field_create_instance(array(
    'field_name' => FIELD_GALLERY_VIEW_FIELD_NAME,
    'entity_type' => 'node',
    'bundle' => 'article',
    'label' => t('Choose gallery View'),
    'description' => t('Gallery view type for display gallery field collection'),
    'widget' => array(
        'type' => 'OPTIONS_SELECT',
        'weight' => 0,
        'settings' => array('size' => 50),
    ),
    'display' => array(
        'default' => array(
            'label' => 'hidden',
            'settings' => array(),
            'weight' => 1,
            'type' => 'hidden'
        ),
        'teaser' => array(
            'label' => 'hidden',
            'settings' => array(),
            'type' => 'hidden',
        ),
    ),
    'required' => TRUE,
));
| improve this answer | |
  • It's included in the docs for ['display']['default']['type'] → "The type of the display formatter, or 'hidden' for no display." – mi6th Nov 15 '17 at 16:42

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.