function party_handler_relationship_party_attached_eid::options_form in Party 8.2
Same name and namespace in other branches
- 7 includes/views/party_handler_relationship_party_attached_eid.inc \party_handler_relationship_party_attached_eid::options_form()
Extends the relationship's basic options.
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,
);
// @todo: this is dependent on the chosen data set NOT being a singleton!
$form['main'] = array(
'#type' => 'checkbox',
'#title' => t('Restrict to main item'),
'#default_value' => $this->options['main'],
'#description' => t("Select to show only the item flagged as the 'main' one of a set. Leaving this unselected may produce duplicate rows."),
);
}