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?

1 Answer 1

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,
));
1
  • It's included in the docs for ['display']['default']['type'] → "The type of the display formatter, or 'hidden' for no display."
    – 0x6d6c
    Commented Nov 15, 2017 at 16:42

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.