class location_handler_field_location_street in Location 6.3
Same name and namespace in other branches
- 7.5 handlers/location_handler_field_location_street.inc \location_handler_field_location_street
- 7.3 handlers/location_handler_field_location_street.inc \location_handler_field_location_street
- 7.4 handlers/location_handler_field_location_street.inc \location_handler_field_location_street
@file Province field handler.
Hierarchy
- class \location_handler_field_location_street extends \views_handler_field
Expanded class hierarchy of location_handler_field_location_street
1 string reference to 'location_handler_field_location_street'
- location_views_data in ./
location.views.inc - Implementation of hook_views_data().
File
- handlers/
location_handler_field_location_street.inc, line 8 - Province field handler.
View source
class location_handler_field_location_street extends views_handler_field {
function construct() {
parent::construct();
$this->additional_fields = array(
'additional' => 'additional',
);
}
function option_definition() {
$options = parent::option_definition();
$options['style'] = array(
'default' => 'both',
);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['style'] = array(
'#title' => t('Display style'),
'#type' => 'select',
'#options' => array(
'both' => t('Both street and additional'),
'street' => t('Street only'),
'additional' => t('Additional only'),
),
'#default_value' => $this->options['style'],
);
}
function render($values) {
$parts = array();
if ($this->options['style'] != 'additional') {
$parts[] = check_plain($values->{$this->field_alias});
}
if ($this->options['style'] != 'street') {
$additional = trim($values->{$this->aliases['additional']});
if (!empty($additional)) {
$parts[] = check_plain($values->{$this->aliases['additional']});
}
}
// @@@ Better theming?
return implode('<br />', $parts);
}
}