Skip to content

Commit

Permalink
Update Views to 7.x-3.25
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Hunt committed Dec 14, 2021
1 parent b40fd76 commit e54806b
Show file tree
Hide file tree
Showing 43 changed files with 483 additions and 225 deletions.
60 changes: 42 additions & 18 deletions docroot/sites/all/modules/contrib/views/README.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
CONTENTS OF THIS FILE
---------------------

* Introduction
* Requirements
* Installation
* Configuration
* Recommended
* Troubleshooting


INTRODUCTION
------------

Welcome to Views 3. Please see the advanced help for more information.
The Views module allows you to fetch content from the database and present it
to the user in a number of ways (lists, posts, maps, graphs, galleries, tables,
menu items, blocks, reports, forum posts, and so on).

Views provides a graphical interface to an SQL query builder that can access
virtually any information in your database, and then display it in any format.

You can also use Views to present related content. For example, you can
display a list of users along with links to the content they have created.

NOTE: Some of the advanced features require additional modules to be installed.

* For a full description of the module, visit the project page:
https://www.drupal.org/project/views

* To submit bug reports and feature suggestions, or track changes:
https://www.drupal.org/project/issues/views

If you're having trouble installing this module, please ensure that your tar
program is not flattening the directory tree, truncating filenames or losing
files.
* To find additional modules extending the functionality of Views:
https://drupal.org/taxonomy/term/89


REQUIREMENTS
Expand All @@ -29,22 +44,31 @@ This module requires the following modules:
INSTALLATION
------------

Install as you would normally install a contributed Drupal module. See:
https://drupal.org/documentation/install/modules-themes/modules-7 for further
information.
* Install as you would normally install a contributed Drupal module. Visit
https://www.drupal.org/node/895232/ for further information.

Navigate to administer >> modules. Enable Views and Views UI.


RECOMMENDED
-----------
CONFIGURATION
-------------

* Configure the user permissions in Administration » People » Permissions:

- Administer views

Access the views administration pages.

- Bypass views access control

Bypass access control when accessing views.

* Customize Views settings in Administration » Structure » Views » Settings.
Use the 'Basic' and 'Advanced' tabs to configure Views.

* SimpleViews (https://www.drupal.org/project/simpleviews):
If you're new to Views, try the Simple Views which can create some often used
Views for you, this might save you some time.

* Advanced help (https://www.drupal.org/project/advanced_help):
If you enable the advanced help, Views will provide more and better help.
TROUBLESHOOTING
---------------

* Here you can find many modules extending the functionality of Views:
http://drupal.org/taxonomy/term/89
* Additional help is available by installing the Advanced Help module at:
https://drupal.org/project/advanced_help
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ class views_handler_area_result extends views_handler_area {
'default' => 'Displaying @start - @end of @total',
'translatable' => TRUE,
);
$options['format_plural'] = array('default' => FALSE, 'bool' => TRUE);
$options['format_plural_count'] = array('default' => '@total');
$options['format_plural_plural'] = array(
'default' => '',
'translatable' => TRUE,
);

return $options;
}
Expand Down Expand Up @@ -51,6 +57,37 @@ class views_handler_area_result extends views_handler_area {
'#default_value' => $this->options['content'],
'#description' => t('You may use HTML code in this field. The following tokens are supported:') . $list,
);
$form['format_plural'] = array(
'#type' => 'checkbox',
'#title' => t('Format plural'),
'#description' => t('If checked, special handling will be used for plurality.'),
'#default_value' => $this->options['format_plural'],
);
$form['format_plural_count'] = array(
'#type' => 'select',
'#title' => t('Count token'),
'#description' => t('Token used to select plural format.'),
'#default_value' => $this->options['format_plural_count'],
'#options' => drupal_map_assoc(array(
'@start',
'@end',
'@total',
'@name',
'@per_page',
'@current_page',
'@current_record_count',
'@page_count'
)),
'#dependency' => array('edit-options-format-plural' => array(TRUE)),
);
$form['format_plural_plural'] = array(
'#title' => t('Plural form'),
'#type' => 'textarea',
'#rows' => 3,
'#default_value' => $this->options['format_plural_plural'],
'#description' => t('Text to use for the plural form.'),
'#dependency' => array('edit-options-format-plural' => array(TRUE)),
);
}

/**
Expand Down Expand Up @@ -100,8 +137,23 @@ class views_handler_area_result extends views_handler_area {
foreach ($items as $item) {
$replacements["@$item"] = ${$item};
}
// Send the output.
if (!empty($total) || !empty($this->options['empty'])) {
// If the format_plural option is selected,
if (
!empty($this->options['format_plural'])
// and the format_plural_count token is not "@end":
&& $replacements[$this->options['format_plural_count']] != 1
) {
$format = $this->options['format_plural_plural'];
}
// If there is an item count,
if (
!empty($total)
// or there is content in the empty area,
|| !empty($this->options['empty'])
// and a query has been performed:
&& !empty($this->view->build_info['count_query'])
) {
// Adds the result to the output.
// We don't want to sanitize with filter_xss_admin() here because Views
// administrators are trusted users and should be allowed to insert
// arbitrary markup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ class views_handler_field extends views_handler {
*/
public $additional_fields = array();

/**
* Keeps track of the last render index.
*
* @var int|NULL
*/
protected $last_render_index = NULL;

/**
* Construct a new field handler.
*/
Expand Down Expand Up @@ -1072,6 +1079,11 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
* text-replacement rendering is necessary.
*/
public function advanced_render($values) {
// Clean up values from previous render calls.
if ($this->last_render_index != $this->view->row_index) {
$this->last_render_text = '';
}

if ($this->allow_advanced_render() && method_exists($this, 'render_item')) {
$raw_items = $this->get_items($values);
// If there are no items, set the original value to NULL.
Expand Down Expand Up @@ -1130,6 +1142,11 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
}
}

// If we rendered something, update the last render index.
if ((string) $this->last_render !== '') {
$this->last_render_index = $this->view->row_index;
}

return $this->last_render;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,16 @@ class views_handler_field_date extends views_handler_field {
$value = strtotime($value);
}

$format = $this->options['date_format'];
if (in_array($format, $this->supported_date_types())) {
$custom_format = $this->options['custom_date_format'];
}

if ($value) {
$format = $this->options['date_format'];

// The custom format can be either a number or a string, depending upon
// what format is being used.
$custom_format = NULL;
if (in_array($format, $this->supported_date_types())) {
$custom_format = $this->options['custom_date_format'];
}

$timezone = !empty($this->options['timezone']) ? $this->options['timezone'] : NULL;
// Will be positive for a datetime in the past (ago), and negative for a
// datetime in the future (hence).
Expand Down Expand Up @@ -205,6 +209,7 @@ class views_handler_field_date extends views_handler_field {
return format_date($value, $format, $custom_format, $timezone);

default:
// The custom format is not used in this scenario.
return format_date($value, $format, '', $timezone);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ class views_handler_field_entity extends views_handler_field {
* Overriden to add the field for the entity id.
*/
public function query() {
$this->table_alias = $base_table = $this->view->base_table;
$this->table_alias = $this->view->base_table;
$this->base_field = $this->view->base_field;

if (!empty($this->relationship)) {
foreach ($this->view->relationship as $relationship) {
if ($relationship->alias == $this->relationship) {
if (isset($relationship->alias) && $relationship->alias == $this->relationship) {
$base_table = $relationship->definition['base'];
$this->table_alias = $relationship->alias;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class views_handler_field_numeric extends views_handler_field {
$options['decimal'] = array('default' => '.', 'translatable' => TRUE);
$options['separator'] = array('default' => ',', 'translatable' => TRUE);
$options['format_plural'] = array('default' => FALSE, 'bool' => TRUE);
$options['format_plural_singular'] = array('default' => '1');
$options['format_plural_plural'] = array('default' => '@count');
$options['format_plural_singular'] = array('default' => '1', 'translatable' => TRUE);
$options['format_plural_plural'] = array('default' => '@count', 'translatable' => TRUE);
$options['prefix'] = array('default' => '', 'translatable' => TRUE);
$options['suffix'] = array('default' => '', 'translatable' => TRUE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,9 @@ class views_handler_filter extends views_handler {
if ($type == 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
$any_label = variable_get('views_exposed_filter_any_label', 'new_any') == 'old_any' ? t('<Any>') : t('- Any -');
$form['#options'] = array('All' => $any_label) + $form['#options'];
$form['#default_value'] = 'All';
if (empty($form['#default_value'])) {
$form['#default_value'] = 'All';
}
}

if (!empty($this->options['expose']['required'])) {
Expand Down Expand Up @@ -1382,7 +1384,12 @@ class views_handler_filter extends views_handler {
}

if (!empty($this->options['expose']['identifier'])) {
$value = $input[$this->options['expose']['identifier']];
if (isset($input[$this->options['expose']['identifier']])) {
$value = $input[$this->options['expose']['identifier']];
}
else {
return FALSE;
}

// Various ways to check for the absence of non-required input.
if (empty($this->options['expose']['required'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ class views_handler_filter_combine extends views_handler_filter_string {
*
*/
public function op_regex($field) {
if (empty($this->value)) {
return;
}
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$field RLIKE $placeholder", array($placeholder => $this->value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ class views_handler_filter_date extends views_handler_filter_numeric {
}

// Store this because it will get overwritten.
$type = $this->value['type'];
$type = '';
if (is_array($this->value)) {
$type = $this->value['type'];
}
$rc = parent::accept_exposed_input($input);

// Don't filter if value(s) are empty.
Expand All @@ -165,7 +168,10 @@ class views_handler_filter_date extends views_handler_filter_numeric {
}

// Restore what got overwritten by the parent.
$this->value['type'] = $type;
if (is_array($this->value)) {
$this->value['type'] = $type;
}

return $rc;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
$form['subquery_sort'] = array(
'#type' => 'select',
'#title' => t('Representative sort criteria'),
// Provide the base field as sane default sort option.
// Provide the base field as the default sort option.
'#default_value' => !empty($this->options['subquery_sort']) ? $this->options['subquery_sort'] : $this->definition['base'] . '.' . $base_table_data['table']['base']['field'],
'#options' => $sort_options,
'#description' => theme('advanced_help_topic', array('module' => 'views', 'topic' => 'relationship-representative')) .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<li><strong>Distinct: No</strong></li>
This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.

<li><strong>Use Slave Server</strong></li>
<li><strong>Use Replica Server</strong></li>

<li><strong>Query Comment</strong></li>
</ul>
Expand Down
Loading

0 comments on commit e54806b

Please sign in to comment.