0

On install I'm trying to set my commerce_products view from table to list. Where and how do I do this? I also need to add a class to the list.

I'm a Drupal noob so if answers could be detailed that would be appreciated.

2
  • You can try to go to your view's edit page and export it. In export window you can see view's code. There you can see $handler->display->display_options['style_plugin'] = 'table'; - there format will be stored. For more info from us you should provide more info from yourself. Commented Aug 18, 2015 at 13:49
  • Thats exactly what I need, but then where in my theme files do I add this line so this is set when theme is installed? Commented Aug 18, 2015 at 14:10

1 Answer 1

2

From your comments it sounds like you want to change the style_plugin from your theme. You need to implement hook_views_default_views_alter() in your theme.

Something like this:

function themename_views_default_views_alter(&$views) {
 if (isset($views['commerce_products']) {
  $views['commerce_products']->display['default']->display_options['style_plugin'] = 'table';
 }
}

I'm not too familiar with commerce so you might not want to target the default display if that display is used elsewhere; you might just want to target the 'page' display.

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.