updated date pathauto addressfield honeypot features modules

This commit is contained in:
Bachir Soussi Chiadmi
2015-10-12 12:03:12 +02:00
parent 0ba0c21bb9
commit eb699f528d
109 changed files with 5363 additions and 2372 deletions

View File

@@ -26,7 +26,7 @@ function addressfield_field_views_data($field) {
// Only expose these components as Views field handlers.
$implemented = array(
'country' => 'addressfield_views_handler_field_country',
'administrative_area' => 'views_handler_field',
'administrative_area' => 'addressfield_views_handler_field_administrative_area',
'sub_administrative_area' => 'views_handler_field',
'dependent_locality' => 'views_handler_field',
'locality' => 'views_handler_field',

View File

@@ -0,0 +1,48 @@
<?php
/**
* Defines a field handler that can display the administrative area name
* instead of the code.
*/
class addressfield_views_handler_field_administrative_area extends views_handler_field {
function query() {
parent::query();
$this->country_alias = $this->query->add_field($this->table_alias, $this->definition['field_name'] . '_country');
}
function option_definition() {
$options = parent::option_definition();
$options['display_name'] = array('default' => TRUE);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['display_name'] = array(
'#type' => 'checkbox',
'#title' => t('Display the name of administrative area instead of the code.'),
'#default_value' => $this->options['display_name'],
);
}
function get_value($values, $field = NULL) {
$value = parent::get_value($values, $field);
// If we have a value for the field, look for the administrative area name in the
// Address Field options list array if specified.
if (!empty($value) && !empty($this->options['display_name'])) {
module_load_include('inc', 'addressfield', 'addressfield.administrative_areas');
$country = $values->{$this->country_alias};
$areas = addressfield_get_administrative_areas($country);
if (!empty($areas[$value])) {
$value = $areas[$value];
}
}
return $value;
}
}