function views_attach_plugin_display_profile::options_form in Views attach 6.2
Same name and namespace in other branches
- 6 views_attach_plugin_display_profile.inc \views_attach_plugin_display_profile::options_form()
- 7.2 views_attach_plugin_display_profile.inc \views_attach_plugin_display_profile::options_form()
Provide the default form for setting options.
File
- ./
views_attach_plugin_display_profile.inc, line 64
Class
- views_attach_plugin_display_profile
- The plugin that handles a user profile.
Code
function options_form(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_form($form, $form_state);
switch ($form_state['section']) {
case 'weight':
$form['#title'] .= t('Weight');
$form['weight'] = array(
'#type' => 'weight',
'#description' => t('The position of this view in relation to other profile elements.'),
'#default_value' => $this
->get_option('weight'),
);
break;
case 'category':
$form['#title'] .= t('Category');
$form['category'] = array(
'#type' => 'textfield',
'#description' => t('The name of the profile section this view should be listed in. If empty, it will be displayed on the main profile section.'),
'#default_value' => $this
->get_option('category'),
);
break;
case 'arguments':
$form['#title'] .= t('Arguments');
$default = $this
->get_option('argument_mode');
$options = array(
'none' => t("No special handling"),
'uid' => t("Use the ID of the user the view is attached to"),
);
$form['argument_mode'] = array(
'#type' => 'radios',
'#title' => t("How should this display populate the view's arguments?"),
'#options' => $options,
'#default_value' => $default,
);
// Add the extra option for Tokens if the module is enabled.
// If it isn't, ensure that we dont' default to 'token'.
if (module_exists('token')) {
$form['argument_mode']['#options']['token'] = t("Use tokens from the user the view is attached to");
$form['token_prefix'] = array(
'#id' => 'views-attached-token-arguments',
'#type' => 'hidden',
'#prefix' => '<div><div id="views-attached-token-arguments">',
'#process' => array(
'views_process_dependency',
),
'#dependency' => array(
'radio:argument_mode' => array(
'token',
),
),
);
$form['default_argument'] = array(
'#type' => 'textfield',
'#default_value' => $this
->get_option('default_argument'),
'#description' => t('You may use token replacement to provide arguments based on the current user profile. Separate arguments with "/".'),
);
$form['token_help'] = array(
'#type' => 'fieldset',
'#title' => t('Replacement tokens'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => theme('token_help', 'user'),
);
$form['token_suffix'] = array(
'#value' => '</div></div>',
);
}
elseif ($default == 'token') {
$form['argument_mode']['#default_value'] = 'none';
}
break;
}
}