function party_handler_relationship_party_attached_eid::options_form in Party 7
Same name and namespace in other branches
- 8.2 includes/views/party_handler_relationship_party_attached_eid.inc \party_handler_relationship_party_attached_eid::options_form()
Extends the relationship's basic options.
Overrides views_handler_relationship::options_form
File
- includes/
views/ party_handler_relationship_party_attached_eid.inc, line 22 - Relationship for party data sets, relating parties to the entities in a set.
Class
- party_handler_relationship_party_attached_eid
- @file Relationship for party data sets, relating parties to the entities in a set.
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// Get all defined data sets.
$sets = party_get_data_set_info();
$options = array();
foreach ($sets as $set_name => $set) {
if ($set['entity type'] == $this->definition['entity_type']) {
// @todo: sort these nicely in some way?
$options[$set_name] = $set['label'];
}
}
// @todo: this is radios for now as I'm not sure multiple data sets in a
// relationship makes sense.
// @todo: this is not needed if there is only one dataset for this entity
// type BUT if the form element is removed, the handler MUST nonetheless
// set its dataset otherwise the query will break!
$form['data_set'] = array(
'#type' => 'radios',
'#title' => t('Data set'),
'#options' => $options,
'#default_value' => $this->options['data_set'],
'#description' => t("The data set entities to create the relationship towards."),
'#required' => TRUE,
);
$form['delta'] = array(
'#type' => 'select',
'#title' => t('Delta'),
'#options' => array(
'all' => t('All'),
0 => '1',
1 => '2',
2 => '3',
3 => '4',
),
'#default_value' => $this->options['delta'],
'#description' => t("Choose which attached entity to create the relationship to."),
);
}