summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list.inc14
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list_string.inc59
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_field_field.inc81
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_filter_field_list.inc21
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_relationship_entity_reverse.inc3
5 files changed, 158 insertions, 20 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list.inc
index f8f10e9..e0f7abe 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list.inc
@@ -1,18 +1,21 @@
<?php
+
/**
* @file
- * Contains views_handler_argument_field_list handler
+ * Definition of views_handler_argument_field_list.
*/
/**
- * Argument handler for list field to show the human readable name in the summary.
+ * Argument handler for list field to show the human readable name in the
+ * summary.
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_field_list extends views_handler_argument_numeric {
/**
- * @var array
* Stores the allowed values of this field.
+ *
+ * @var array
*/
var $allowed_values = NULL;
@@ -24,7 +27,7 @@ class views_handler_argument_field_list extends views_handler_argument_numeric {
function option_definition() {
$options = parent::option_definition();
- $options['summary']['contains']['human'] = array('default' => FALSE);
+ $options['summary']['contains']['human'] = array('default' => FALSE, 'bool' => TRUE);
return $options;
}
@@ -35,7 +38,7 @@ class views_handler_argument_field_list extends views_handler_argument_numeric {
$form['summary']['human'] = array(
'#title' => t('Display list value as human readable'),
'#type' => 'checkbox',
- '#default_value' => $this->options['summary']['human'],#
+ '#default_value' => $this->options['summary']['human'],
'#dependency' => array('radio:options[default_action]' => array('summary')),
);
}
@@ -53,4 +56,3 @@ class views_handler_argument_field_list extends views_handler_argument_numeric {
}
}
}
-
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list_string.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list_string.inc
new file mode 100644
index 0000000..67a9f2d
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_argument_field_list_string.inc
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_argument_field_list_text.
+ */
+
+/**
+ * Argument handler for list field to show the human readable name in the
+ * summary.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_field_list_string extends views_handler_argument_string {
+ /**
+ * Stores the allowed values of this field.
+ *
+ * @var array
+ */
+ var $allowed_values = NULL;
+
+ function init(&$view, &$options) {
+ parent::init($view, $options);
+ $field = field_info_field($this->definition['field_name']);
+ $this->allowed_values = list_allowed_values($field);
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+
+ $options['summary']['contains']['human'] = array('default' => FALSE, 'bool' => TRUE);
+
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+
+ $form['summary']['human'] = array(
+ '#title' => t('Display list value as human readable'),
+ '#type' => 'checkbox',
+ '#default_value' => $this->options['summary']['human'],
+ '#dependency' => array('radio:options[default_action]' => array('summary')),
+ );
+ }
+
+
+ function summary_name($data) {
+ $value = $data->{$this->name_alias};
+ // If the list element has a human readable name show it,
+ if (isset($this->allowed_values[$value]) && !empty($this->options['summary']['human'])) {
+ return $this->case_transform(field_filter_xss($this->allowed_values[$value]), $this->options['case']);
+ }
+ // else fallback to the key.
+ else {
+ return $this->case_transform(check_plain($value), $this->options['case']);
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_field_field.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_field_field.inc
index 8e0b767..b50a0ae 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_field_field.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_field_field.inc
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Definition of views_handler_field_field.
+ */
+
+/**
* Helper function: Return an array of formatter options for a field type.
*
* Borrowed from field_ui.
@@ -28,19 +33,54 @@ function _field_view_formatter_options($field_type = NULL) {
}
/**
- * A field that displays fields.
+ * A field that displays fieldapi fields.
+ *
+ * @ingroup views_field_handlers
*/
class views_handler_field_field extends views_handler_field {
/**
* An array to store field renderable arrays for use by render_items.
+ *
+ * @var array
*/
public $items = array();
/**
- * Store the field informations.
+ * Store the field information.
+ *
+ * @var array
*/
public $field_info = array();
+
+ /**
+ * Does the field supports multiple field values.
+ *
+ * @var bool
+ */
+ public $multiple;
+
+ /**
+ * Does the rendered fields get limited.
+ *
+ * @var bool
+ */
+ public $limit_values;
+
+ /**
+ * A shortcut for $view->base_table.
+ *
+ * @var string
+ */
+ public $base_table;
+
+ /**
+ * Store the field instance.
+ *
+ * @var array
+ */
+ public $instance;
+
function init(&$view, &$options) {
parent::init($view, $options);
@@ -68,10 +108,19 @@ class views_handler_field_field extends views_handler_field {
$this->limit_values = TRUE;
}
}
+
+ // Convert old style entity id group column to new format.
+ // @todo Remove for next major version.
+ if ($this->options['group_column'] == 'entity id') {
+ $this->options['group_column'] = 'entity_id';
+ }
}
/**
- * Return TRUE if the user has access to view this field.
+ * Check whether current user has access to this handler.
+ *
+ * @return bool
+ * Return TRUE if the user has access to view this field.
*/
function access() {
$base_table = $this->get_base_table();
@@ -80,6 +129,9 @@ class views_handler_field_field extends views_handler_field {
/**
* Set the base_table and base_table_alias.
+ *
+ * @return string
+ * The base table which is used in the current view "context".
*/
function get_base_table() {
if (!isset($this->base_table)) {
@@ -170,7 +222,7 @@ class views_handler_field_field extends views_handler_field {
$options = array($this->options['group_column'] => $this->options['group_column']);
}
- $options += $this->options['group_columns'];
+ $options += is_array($this->options['group_columns']) ? $this->options['group_columns'] : array();
$fields = array();
@@ -206,7 +258,8 @@ class views_handler_field_field extends views_handler_field {
$this->view->display_handler->options['field_language']);
$placeholder = $this->placeholder();
$language_fallback_candidates = array($language);
- if (variable_get('locale_field_language_fallback', TRUE) && module_exists('locale')) {
+ if (variable_get('locale_field_language_fallback', TRUE)) {
+ require_once DRUPAL_ROOT . '/includes/language.inc';
$language_fallback_candidates = array_merge($language_fallback_candidates, language_fallback_get_candidates());
}
else {
@@ -312,6 +365,7 @@ class views_handler_field_field extends views_handler_field {
// Options used for multiple value fields.
$options['group_rows'] = array(
'default' => TRUE,
+ 'bool' => TRUE,
);
// If we know the exact number of allowed values, then that can be
// the default. Otherwise, default to 'all'.
@@ -323,9 +377,11 @@ class views_handler_field_field extends views_handler_field {
);
$options['delta_reversed'] = array(
'default' => FALSE,
+ 'bool' => TRUE,
);
$options['delta_first_last'] = array(
'default' => FALSE,
+ 'bool' => TRUE,
);
$options['multi_type'] = array(
@@ -337,6 +393,7 @@ class views_handler_field_field extends views_handler_field {
$options['field_api_classes'] = array(
'default' => FALSE,
+ 'bool' => TRUE,
);
return $options;
@@ -364,7 +421,7 @@ class views_handler_field_field extends views_handler_field {
else {
$form['click_sort_column'] = array(
'#type' => 'select',
- '#title' => t('Click sort column'),
+ '#title' => t('Column used for click sorting'),
'#options' => drupal_map_assoc($column_names),
'#default_value' => $this->options['click_sort_column'],
'#description' => t('Used by Style: Table to determine the actual column to click sort the field on. The default is usually fine.'),
@@ -405,10 +462,10 @@ class views_handler_field_field extends views_handler_field {
// Provide an instance array for hook_field_formatter_settings_form().
ctools_include('fields');
- $instance = ctools_fields_fake_field_instance($this->definition['field_name'], '_dummy', $formatter, $settings);
+ $this->instance = ctools_fields_fake_field_instance($this->definition['field_name'], '_custom', $formatter, $settings);
- // Store the settings in a '_dummy' view mode.
- $instance['display']['_dummy'] = array(
+ // Store the settings in a '_custom' view mode.
+ $this->instance['display']['_custom'] = array(
'type' => $format,
'settings' => $settings,
);
@@ -417,7 +474,7 @@ class views_handler_field_field extends views_handler_field {
$settings_form = array('#value' => array());
$function = $formatter['module'] . '_field_formatter_settings_form';
if (function_exists($function)) {
- $settings_form = $function($field, $instance, '_dummy', $form, $form_state);
+ $settings_form = $function($field, $this->instance, '_custom', $form, $form_state);
}
$form['settings'] = $settings_form;
}
@@ -574,7 +631,7 @@ class views_handler_field_field extends views_handler_field {
$entities_by_type = array();
$revisions_by_type = array();
foreach ($values as $key => $object) {
- if (isset($object->{$this->field_alias}) && !isset($values[$key]->_field_data[$this->field_alias])) {
+ if (isset($this->aliases['entity_type']) && isset($object->{$this->aliases['entity_type']}) && isset($object->{$this->field_alias}) && !isset($values[$key]->_field_data[$this->field_alias])) {
$entity_type = $object->{$this->aliases['entity_type']};
if (empty($this->definition['is revision'])) {
$entity_id = $object->{$this->field_alias};
@@ -804,7 +861,7 @@ class views_handler_field_field extends views_handler_field {
if (isset($render_array['#access'])) {
$items[$count]['rendered']['#access'] = $render_array['#access'];
}
- // Only add the raw field items (for use in tokens) if the curent user
+ // Only add the raw field items (for use in tokens) if the current user
// has access to view the field content.
if ((!isset($items[$count]['rendered']['#access']) || $items[$count]['rendered']['#access']) && !empty($render_array['#items'][$count])) {
$items[$count]['raw'] = $render_array['#items'][$count];
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_filter_field_list.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_filter_field_list.inc
index 971fb35..440d55b 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_filter_field_list.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_filter_field_list.inc
@@ -1,11 +1,30 @@
<?php
/**
+ * @file
+ * Definition of views_handler_filter_field_list.
+ */
+
+/**
* Filter handler which uses list-fields as options.
*
* @ingroup views_filter_handlers
*/
-class views_handler_filter_field_list extends views_handler_filter_in_operator {
+class views_handler_filter_field_list extends views_handler_filter_many_to_one {
+
+ function init(&$view, &$options) {
+ parent::init($view, $options);
+ // Migrate the settings from the old filter_in_operator values to filter_many_to_one.
+ if ($this->options['operator'] == 'in') {
+ $this->options['operator'] = 'or';
+ }
+ if ($this->options['operator'] == 'not in') {
+ $this->options['operator'] = 'not';
+ }
+ $this->operator = $this->options['operator'];
+ }
+
+
function get_value_options() {
$field = field_info_field($this->definition['field_name']);
$this->value_options = list_allowed_values($field);
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_relationship_entity_reverse.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_relationship_entity_reverse.inc
index c83fa11..89f2483 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_relationship_entity_reverse.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/field/views_handler_relationship_entity_reverse.inc
@@ -1,7 +1,8 @@
<?php
+
/**
* @file
- * Views' relationship handlers.
+ * Definition of views_handler_relationship_entity_reverse.
*/
/**