If I export a draggable view to code, the settings aren't exported, see code

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'draggabletable';
$handler->display->display_options['style_options']['columns'] = array(
  'field_button_icon_fid' => 'field_button_icon_fid',
  'title' => 'title',
  'field_button_linkto_nid' => 'field_button_linkto_nid',
  'field_button_order_value' => 'field_button_order_value',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'field_button_icon_fid' => array(
    'align' => '',
    'separator' => '',
  ),
  'title' => array(
    'sortable' => 0,
    'align' => '',
    'separator' => '',
  ),
  'field_button_linkto_nid' => array(
    'align' => '',
    'separator' => '',
  ),
  'field_button_order_value' => array(
    'sortable' => 0,
    'align' => '',
    'separator' => '',
  ),
);
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['path'] = 'buttons-order';

Comments

attiks’s picture

I fixed this by adding the following line to views/draggableviews_plugin_style_draggabletable.inc

    $options['tabledrag_order'] = array('default' => array());
attiks’s picture

Version: 6.x-3.4 » 6.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new835 bytes

Patch agains 6.x-3.x

dixon_’s picture

Status: Needs review » Needs work
StatusFileSize
new10.07 KB

Actually there is more settings missing. Views 3 more strict and does only export options defined in options_definition(). So here is a patch that should cover all settings for the native handler. Being more strict about the definition of options also saves us some logic in the form building as Views pre populates the options!

But we need to figure out a way to get settings added via hook_draggableviews_style_plugin_form_alter() exportable. Maybe we can add a hook in option_definition() that'll let other modules add their options... But hopefully there is a cleaner way around this. I'll look into it.

But first, here is a patch that should work for the native handler, needs work with other handlers as mentioned above. It is backwards compatible with Views 2.x also!

dixon_’s picture

Ok. I've tested my patch from #3 on several sites for a while, and it seems to work fine. I've committed this to DRUPAL-6--3.

But we still need to figure out how to support handlers implementing hook_draggableviews_style_plugin_form_alter().

recrit’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
StatusFileSize
new9.92 KB

saw this in 7.x also. The attached patch is #3 applied to 7.x-1.x-dev. Please commit to 7.x also.

sjs’s picture

Hi.

That patch (#5) fixed the export problem for me in DraggableViews 7.x-1.x-dev (2011-Feb-25).

Thanks.

ginc’s picture

Status: Needs work » Needs review
ygerasimov’s picture

Status: Needs review » Fixed

committed. thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.