function nodereferrer_view_handler_field::options_form in NodeReferrer 6
Same name and namespace in other branches
- 7 views/nodereferrer_view_handler_field.inc \nodereferrer_view_handler_field::options_form()
Form to get field parameters
File
- views/
nodereferrer_view_handler_field.inc, line 15 - nodereferrer.module Views integration
Class
- nodereferrer_view_handler_field
- We use this as a parent class for both the nodereferrer fields. This handler is not meant to be used directly.
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$options = nodereferrer_field_formatter_info();
foreach ($options as $k => $v) {
$options[$k] = $v['label'];
}
$form['formatter'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#title' => t('Formatter'),
'#options' => $options,
'#description' => t('Select the formatter to use to display the fields'),
'#default_value' => empty($this->options['formatter']) ? '' : $this->options['formatter'],
);
$form['list'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#title' => t('Display as'),
'#options' => array(
'list' => 'List items',
'comma' => 'Comma separated list',
),
'#description' => t('Select how multiple values should be displayed'),
'#default_value' => empty($this->options['list']) ? 'list' : $this->options['list'],
);
$form['limit'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#title' => t('Limit'),
'#options' => array(
0 => t('Unlimited'),
) + drupal_map_assoc(range(1, 10)),
'#description' => t('Select how many referencing nodes will be displayed'),
'#default_value' => empty($this->options['limit']) ? 0 : $this->options['limit'],
);
$form['randomize'] = array(
'#type' => 'checkbox',
'#title' => t('Randomize'),
'#description' => t('Check this box if you want the referrers to be displayed in random order'),
'#default_value' => empty($this->options['randomize']) ? FALSE : $this->options['randomize'],
);
$form['fields'] = array(
'#type' => 'checkboxes',
'#multiple' => TRUE,
'#title' => $this
->get_options_title(),
'#options' => $this
->get_options(),
'#description' => t('This is optional ; if nothing is selected then all referrers will be returned'),
'#default_value' => empty($this->options['fields']) ? array() : $this->options['fields'],
);
if (module_exists('translation')) {
$form['multilingual'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Multilingual options'),
);
$default = 0;
if (!empty($this->options['multilingual']['referrers_of_translations'])) {
$default = $this->options['multilingual']['referrers_of_translations'];
}
$form['multilingual']['referrers_of_translations'] = array(
'#type' => 'checkbox',
'#title' => t('Include referrers of translations'),
'#description' => t('If this is checked, will also include nodes that refer to translations of the given node'),
'#default_value' => $default,
);
$default = 0;
if (!empty($this->options['multilingual']['translations_of_referrers'])) {
$default = $this->options['multilingual']['translations_of_referrers'];
}
$form['multilingual']['translations_of_referrers'] = array(
'#type' => 'checkbox',
'#title' => t('Include translations of referrers'),
'#description' => t('If this is checked, will also include translations of nodes that refer to the given node. You may not need this if you synchronise your CCK field.'),
'#default_value' => $default,
);
}
}