How remove a view mode programmatically in D7?

by donquixote   Last Updated January 11, 2018 02:07 AM

In the past, I

  • created a view mode (for commerce_product) using hook_entity_info_alter(), the usual way.
  • saved field display settings and display suite settings for this view mode.
  • exported those settings with features.

Now I want to remove this view mode from my code and settings.

What is the correct, "by the book" way of doing this?

What I tried so far:

  • Remove the hook_entity_info_alter() that defines the view mode.
  • Clear the cache.
  • Save the "default" display settings page which contains the checkbox for "custom display settings".
  • Update the feature that contains the exported settings.

For some reason, the view mode settings don't want to go away.

What I will try next:

  • Manually remove the stuff from the feature modules code.

Maybe there is no better solution. But maybe there is. This is why I ask.

Tags : 7 view-modes

Related Questions

Need URL to stay the same for Ajax call

Updated May 21, 2015 21:03 PM

node preview on based on view modes

Updated May 09, 2017 11:07 AM