Skip to content

Instantly share code, notes, and snippets.

@jessebeach
Created February 14, 2011 22:06
Show Gist options
  • Save jessebeach/826666 to your computer and use it in GitHub Desktop.
Save jessebeach/826666 to your computer and use it in GitHub Desktop.
lines 917 - 953
// Add preview controls
$form['displays']['preview_controls'] = array(
'#theme_wrappers' => array('container'),
);
// Add a checkbox controlling whether or not this display auto-previews.
$form['displays']['preview_controls']['live_preview'] = array(
'#type' => 'checkbox',
'#title' => t('Auto preview'),
'#default_value' => !variable_get('views_ui_disable_live_preview', 0),
);
$form['displays']['preview_controls']['form'] = array(
'#theme_wrappers' => array('container'),
'#attributes' => array('class' => array('arguments-preview')),
'#process' => array('ctools_dependent_process'),
'#dependency' => array('edit-displays-live-preview' => array(0)),
'#id' => 'preview-form',
);
$form['displays']['preview_controls']['form']['view_args'] = array(
'#type' => 'textfield',
'#title' => t('Arguments'),
'#description' => t('Separate arguments with a / as though they were a URL path.'),
'#id' => 'preview-args',
);
$form['displays']['preview_controls']['form']['button'] = array(
'#type' => 'submit',
'#value' => t('Preview'),
'#id' => 'preview-submit',
'#ajax' => array(
'callback' => 'views_ui_preview_callback',
'wrapper' => 'views-live-preview',
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment