0

I have declared a custom entity with a schema with a few fields on which is all working as I expect.

I want to remove the label when rendering the entity so have tried the following.

Added some view modes to the entity info hook and although I can see that they exist when I go to manage display none of my entity fields appear. Not sure if this is how it should work or not.

Any ideas?

2
  • Did you use drupal.org/project/eck module? Commented Aug 20, 2014 at 23:34
  • No I'm using entity api and a custom entity, I would like to be able to build different view modes in code but I don't think it is possible. I did find a solution see below. Commented Aug 21, 2014 at 8:48

1 Answer 1

0

The below function stops a custom entity label from being rendered based on the view mode.

function HOOK_entity_view_alter(&$build, $type) { if($type == 'YOUR_ENTITY_TYPE' && $build['#entity_view_mode']['view_mode'] == 'YOUR_VIEW_MODE'){ $build['#page'] = TRUE; } } 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.