Parcourir la source

[up] Views 7.x-3.18

opi il y a 7 ans
Parent
commit
51a9ee8175

+ 42 - 11
sites/all/modules/views/README.txt

@@ -1,19 +1,50 @@
+CONTENTS OF THIS FILE
+---------------------
+   
+ * Introduction
+ * Requirements
+ * Installation
+ * Configuration
+ * Recommended
+
+
+INTRODUCTION
+------------
 
 Welcome to Views 3. Please see the advanced help for more information.
 
-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.
+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.
+
+
+REQUIREMENTS
+------------
+
+This module requires the following modules:
+
+ * Chaos tool suite (ctools) (https://drupal.org/project/ctools)
+
+
+INSTALLATION
+------------
+
+Install as you would normally install a contributed Drupal module. See:
+https://drupal.org/documentation/install/modules-themes/modules-7 for further
+information.
+
+Navigate to administer >> modules. Enable Views and Views UI.
 
-Installing Views:
 
-Place the entirety of this directory in sites/all/modules/views
-You must also install the CTools module (http://www.drupal.org/project/ctools)  to use Views.
+RECOMMENDED
+-----------
 
-Navigate to administer >> build >> modules. Enable Views and Views UI.
+ * 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.
 
-If you're new to Views, try the Simple Views module 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.
 
-Here you can find many modules extending the functionality of Views:
-  http://drupal.org/taxonomy/term/89
+ * Here you can find many modules extending the functionality of Views:
+   http://drupal.org/taxonomy/term/89

+ 1 - 1
sites/all/modules/views/includes/ajax.inc

@@ -40,7 +40,7 @@ function views_ajax() {
 
     // Load the view.
     $view = views_get_view($name);
-    if ($view && $view->access($display_id)) {
+    if ($view && $view->access($display_id) && $view->set_display($display_id) && $view->display_handler->use_ajax()) {
       // Fix 'q' for paging.
       if (!empty($path)) {
         $_GET['q'] = $path;

+ 12 - 0
sites/all/modules/views/includes/handlers.inc

@@ -1544,6 +1544,12 @@ class views_join {
 
     // Tack on the extra.
     if (isset($this->extra)) {
+      // If extra has been provided as string instead of an array, convert it
+      // to an array.
+      if (!is_array($this->extra)) {
+        $this->extra = array($this->extra);
+      }
+
       $extras = array();
       foreach ($this->extra as $info) {
         if (is_array($info)) {
@@ -1658,6 +1664,12 @@ class views_join_subquery extends views_join {
     // This is just copied verbatim from the parent class, which itself has a
     // bug: http://drupal.org/node/1118100
     if (isset($this->extra)) {
+      // If extra has been provided as string instead of an array, convert it
+      // to an array.
+      if (!is_array($this->extra)) {
+        $this->extra = array($this->extra);
+      }
+
       $extras = array();
       foreach ($this->extra as $info) {
         if (is_array($info)) {

+ 1 - 1
sites/all/modules/views/modules/node.views.inc

@@ -733,7 +733,7 @@ function node_row_node_view_preprocess_node(&$vars) {
     unset($vars['content']['links']);
   }
 
-  if (module_exists('comments') && !empty($options['comments']) && user_access('access comments') && $node->comment) {
+  if (module_exists('comment') && !empty($options['comments']) && user_access('access comments') && $node->comment) {
     $vars['content']['comments'] = comment_node_page_additions($node);
   }
 }

+ 1 - 1
sites/all/modules/views/modules/node/views_plugin_row_node_view.inc

@@ -61,7 +61,7 @@ class views_plugin_row_node_view extends views_plugin_row {
       '#type' => 'checkbox',
       '#title' => t('Display comments'),
       '#default_value' => $this->options['comments'],
-      '#access' => module_exists('comments'),
+      '#access' => module_exists('comment'),
     );
   }
 

+ 2 - 2
sites/all/modules/views/modules/search.views.inc

@@ -43,14 +43,14 @@ function search_views_data() {
       'left_table' => 'search_index',
       'left_field' => 'sid',
       'field' => 'sid',
-      'extra' => 'search_index.type = search_dataset.type',
+      'extra' => array('search_index.type = search_dataset.type'),
       'type' => 'INNER',
     ),
     'users' => array(
       'left_table' => 'search_index',
       'left_field' => 'sid',
       'field' => 'sid',
-      'extra' => 'search_index.type = search_dataset.type',
+      'extra' => array('search_index.type = search_dataset.type'),
       'type' => 'INNER',
     ),
   );

+ 1 - 1
sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc

@@ -275,7 +275,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
 
     // We only validate if they've chosen the text field style.
     if ($this->options['type'] != 'textfield') {
-      if ($form_state['values'][$identifier] != 'All')  {
+      if (isset($form_state['values'][$identifier]) && $form_state['values'][$identifier] != 'All') {
         $this->validated_exposed_input = (array) $form_state['values'][$identifier];
       }
       return;

+ 50 - 4
sites/all/modules/views/plugins/views_plugin_display.inc

@@ -366,6 +366,19 @@ class views_plugin_display extends views_plugin {
   }
 
   /**
+   * Should the enabled display more link being opened in an new window?
+   *
+   * @codingStandardsIgnoreStart
+   */
+  function use_more_open_new_window() {
+    // @codingStandardsIgnoreEnd
+    if (!empty($this->definition['use more'])) {
+      return $this->get_option('open_new_window');
+    }
+    return FALSE;
+  }
+
+  /**
    * Does the display have custom link text?
    */
   function use_more_text() {
@@ -414,9 +427,29 @@ class views_plugin_display extends views_plugin {
       'hide_admin_links' => array('hide_admin_links'),
       'group_by' => array('group_by'),
       'query' => array('query'),
-      'use_more' => array('use_more', 'use_more_always', 'use_more_text'),
-      'use_more_always' => array('use_more', 'use_more_always', 'use_more_text'),
-      'use_more_text' => array('use_more', 'use_more_always', 'use_more_text'),
+      'use_more' => array('use_more',
+        'use_more_always',
+        'open_new_window',
+        'use_more_text',
+      ),
+      'use_more_always' => array(
+        'use_more',
+        'use_more_always',
+        'open_new_window',
+        'use_more_text',
+      ),
+      'use_more_text' => array(
+        'use_more',
+        'use_more_always',
+        'open_new_window',
+        'use_more_text',
+      ),
+      'open_new_window' => array(
+        'use_more',
+        'use_more_always',
+        'open_new_window',
+        'use_more_text',
+      ),
       'link_display' => array('link_display', 'link_url'),
 
       // Force these to cascade properly.
@@ -481,6 +514,7 @@ class views_plugin_display extends views_plugin {
           'pager_options' => TRUE,
           'use_more' => TRUE,
           'use_more_always' => TRUE,
+          'open_new_window' => FALSE,
           'use_more_text' => TRUE,
           'exposed_form' => TRUE,
           'exposed_form_options' => TRUE,
@@ -1529,6 +1563,17 @@ class views_plugin_display extends views_plugin {
               'edit-use-more' => array(TRUE),
             ),
         );
+
+        $form['open_new_window'] = array(
+          '#type' => 'checkbox',
+          '#title' => t("Open 'more' link in new window (target='blank')"),
+          '#description' => t("Leave this unchecked to open the more link in the same window."),
+          '#default_value' => $this->get_option('open_new_window'),
+          '#dependency' => array(
+            'edit-use-more' => array(TRUE),
+          ),
+        );
+
         $form['use_more_text'] = array(
           '#type' => 'textfield',
           '#title' => t('More link text'),
@@ -2386,6 +2431,7 @@ class views_plugin_display extends views_plugin {
       case 'use_more':
         $this->set_option($section, intval($form_state['values'][$section]));
         $this->set_option('use_more_always', !intval($form_state['values']['use_more_always']));
+        $this->set_option('open_new_window', $form_state['values']['open_new_window']) == '1';
         $this->set_option('use_more_text', $form_state['values']['use_more_text']);
       case 'distinct':
         $this->set_option($section, $form_state['values'][$section]);
@@ -2599,7 +2645,7 @@ class views_plugin_display extends views_plugin {
 
         $path = check_url(url($path, $url_options));
 
-        return theme($theme, array('more_url' => $path, 'link_text' => check_plain($this->use_more_text()), 'view' => $this->view));
+        return theme($theme, array('more_url' => $path, 'new_window' => $this->use_more_open_new_window(), 'link_text' => check_plain($this->use_more_text()), 'view' => $this->view));
       }
     }
   }

+ 1 - 1
sites/all/modules/views/plugins/views_plugin_pager_full.inc

@@ -417,7 +417,7 @@ class views_plugin_pager_full extends views_plugin_pager {
   function exposed_form_validate(&$form, &$form_state) {
     if (!empty($form_state['values']['offset']) && trim($form_state['values']['offset'])) {
       if (!is_numeric($form_state['values']['offset']) || $form_state['values']['offset'] < 0) {
-        form_set_error('offset', t('Offset must be an number greather or equal than 0.'));
+        form_set_error('offset', t('Offset must be an number greater or equal than 0.'));
       }
     }
   }

+ 109 - 0
sites/all/modules/views/tests/views_ajax.test

@@ -0,0 +1,109 @@
+<?php
+
+/**
+ * @file
+ * Definition of ViewsAjaxTest.
+ */
+
+/**
+ * Tests views ajax display.
+ */
+class ViewsAjaxTest extends ViewsSqlTest {
+  public static function getInfo() {
+    return array(
+      'name' => 'Ajax',
+      'description' => 'Test views with and without ajax enabled.',
+      'group' => 'Views Handlers',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp('views', 'views_test');
+    // Create a second node.
+    $this->drupalCreateNode(array('type' => 'article', 'status' => NODE_PUBLISHED));
+  }
+
+  /**
+   * Perform a simple AJAX POST HTTP request.
+   *
+   * @param string $path
+   *   Drupal path where the request should be POSTed.
+   * @param string $accept
+   *   The value for the "Accept" header. Usually either 'application/json' or
+   *   'application/vnd.drupal-ajax'.
+   * @param array $post
+   *   The POST data. When making a 'application/vnd.drupal-ajax' request, the
+   *   Ajax page state data should be included. Use getAjaxPageStatePostData()
+   *   for that.
+   *
+   * @return
+   *   The content returned from the call to curl_exec().
+   */
+  public function simpleAjaxPost($path, $accept, $post = array()) {
+    $options['absolute'] = TRUE;
+    foreach ($post as $key => $value) {
+      // Encode according to application/x-www-form-urlencoded
+      // Both names and values needs to be urlencoded, according to
+      // http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
+      $post[$key] = urlencode($key) . '=' . urlencode($value);
+    }
+    $postfields = implode('&', $post);
+    $headers = array(
+      'Accept: ' . $accept,
+      'Content-Type: application/x-www-form-urlencoded',
+    );
+    return $this->curlExec(array(
+      CURLOPT_URL => url($path, $options),
+      CURLOPT_POST => TRUE,
+      CURLOPT_POSTFIELDS => $postfields,
+      CURLOPT_HTTPHEADER => $headers,
+    ));
+  }
+
+  /**
+   * Tests an ajax and non-ajax view.
+   */
+  public function testAjaxView() {
+    $this->drupalCreateNode();
+    $this->drupalGet('test_ajax_view');
+    $drupal_settings = $this->drupalGetSettings();
+    $this->assertTrue(isset($drupal_settings['views']['ajax_path']), 'The Ajax callback path is set in drupalSettings.');
+    $this->assertEqual(count($drupal_settings['views']['ajaxViews']), 1);
+    $view_entry = current(array_keys($drupal_settings['views']['ajaxViews']));
+    $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.');
+    $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.');
+
+    $post = array(
+      'view_name' => 'test_ajax_view',
+      'view_display_id' => 'page_1',
+    );
+
+    $response = $this->simpleAjaxPost('views/ajax', 'application/json', $post);
+    $data = drupal_json_decode($response);
+
+    $this->assertTrue(isset($data[0]['settings']['views']['ajaxViews']));
+
+    // Ensure that the view insert command is part of the result.
+    $this->assertEqual($data[1]['command'], 'insert');
+    $this->assertTrue(strpos($data[1]['selector'], '.view-dom-id-') === 0);
+
+    $this->drupalSetContent($data[1]['data']);
+    $result = $this->xpath('//div[contains(@class, "views-row")]');
+    $this->assertEqual(count($result), 2, 'Ensure that two items are rendered in the HTML.');
+
+    $post = array(
+      'view_name' => 'test_noajax_view',
+      'view_display_id' => 'default',
+    );
+
+    $response = $this->simpleAjaxPost('views/ajax', 'application/json', $post);
+    $data = drupal_json_decode($response);
+    // In Drupal 7 we get an ajax response with no commands instead of a 403 if
+    // the view cannot be accessed.
+    foreach ($data as $item) {
+      $this->assertIdentical('settings', $item['command']);
+      $this->assertTrue(empty($item['data']));
+    }
+  }
+
+}

+ 3 - 3
sites/all/modules/views/tests/views_test.info

@@ -5,9 +5,9 @@ core = 7.x
 dependencies[] = views
 hidden = TRUE
 
-; Information added by Drupal.org packaging script on 2017-04-02
-version = "7.x-3.16"
+; Information added by Drupal.org packaging script on 2017-08-23
+version = "7.x-3.18"
 core = "7.x"
 project = "views"
-datestamp = "1491158591"
+datestamp = "1503495103"
 

+ 52 - 0
sites/all/modules/views/tests/views_test.views_default.inc

@@ -274,5 +274,57 @@ function views_test_views_default_views() {
 
   $views[$view->name] = $view;
 
+  $view = new view();
+  $view->name = 'test_ajax_view';
+  $view->description = '';
+  $view->tag = '';
+  $view->base_table = 'node';
+  $view->human_name = '';
+  $view->core = 0;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Master */
+  $handler = $view->new_display('default', 'Master', 'default');
+  $handler->display->display_options['use_ajax'] = TRUE;
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'none';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'none';
+  $handler->display->display_options['style_plugin'] = 'default';
+  $handler->display->display_options['row_plugin'] = 'node';
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page_1');
+  $handler->display->display_options['path'] = 'test_ajax_view';
+
+  $views[$view->name] = $view;
+
+  $view = new view();
+  $view->name = 'test_noajax_view';
+  $view->description = '';
+  $view->tag = '';
+  $view->base_table = 'node';
+  $view->human_name = '';
+  $view->core = 0;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Master */
+  $handler = $view->new_display('default', 'Master', 'default');
+  $handler->display->display_options['use_ajax'] = FALSE;
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'none';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'none';
+  $handler->display->display_options['style_plugin'] = 'default';
+  $handler->display->display_options['row_plugin'] = 'node';
+
+  $views[$view->name] = $view;
+
   return $views;
 }

+ 7 - 0
sites/all/modules/views/tests/views_view.test

@@ -7,8 +7,11 @@
 
 /**
  * Views class tests.
+ *
+ * @codingStandardsIgnoreStart
  */
 class ViewsViewTest extends ViewsSqlTest {
+  // @codingStandardsIgnoreEnd
   public static function getInfo() {
     return array(
       'name' => 'Test the view class',
@@ -227,6 +230,8 @@ class ViewsViewTest extends ViewsSqlTest {
       'default' => 'default',
       'page_1' => 'page_1',
     );
+
+    // @codingStandardsIgnoreLine
     $translatables['test_destroy'] = array(
       t('Master'),
       t('more'),
@@ -272,6 +277,8 @@ class ViewsViewTest extends ViewsSqlTest {
     $handler->display->display_options['pager']['type'] = 'full';
     $handler->display->display_options['style_plugin'] = 'default';
     $handler->display->display_options['row_plugin'] = 'fields';
+
+    // @codingStandardsIgnoreLine
     $translatables['test_view_delete'] = array(
       t('Defaults'),
       t('more'),

+ 4 - 1
sites/all/modules/views/theme/views-more.tpl.php

@@ -7,13 +7,16 @@
  * - $view: The view object.
  * - $more_url: the url for the more link.
  * - $link_text: the text for the more link.
+ * - $new_window: The flag that indicates if link should be opened in a new
+ *   window.
  *
  * @ingroup views_templates
  */
 ?>
 
 <div class="more-link">
-  <a href="<?php print $more_url ?>">
+  <a href="<?php print $more_url ?>"<?php if (!empty($new_window)) { ?> target="_blank"<?php
+ } ?>>
     <?php print $link_text; ?>
   </a>
 </div>

+ 4 - 3
sites/all/modules/views/views.info

@@ -301,6 +301,7 @@ files[] = tests/styles/views_plugin_style_unformatted.test
 files[] = tests/views_access.test
 files[] = tests/views_analyze.test
 files[] = tests/views_basic.test
+files[] = tests/views_ajax.test
 files[] = tests/views_argument_default.test
 files[] = tests/views_argument_validator.test
 files[] = tests/views_exposed_form.test
@@ -327,9 +328,9 @@ files[] = tests/views_cache.test
 files[] = tests/views_view.test
 files[] = tests/views_ui.test
 
-; Information added by Drupal.org packaging script on 2017-04-02
-version = "7.x-3.16"
+; Information added by Drupal.org packaging script on 2017-08-23
+version = "7.x-3.18"
 core = "7.x"
 project = "views"
-datestamp = "1491158591"
+datestamp = "1503495103"
 

+ 6 - 5
sites/all/modules/views/views.install

@@ -252,8 +252,7 @@ function views_schema_6000() {
     ),
   );
 
-  // $schema['cache_views_data'] added in views_schema_6006()
-
+  // $schema['cache_views_data'] added in views_schema_6006().
   return $schema;
 }
 
@@ -295,8 +294,10 @@ function views_update_6001() {
   update_sql("UPDATE {blocks} SET delta = CONCAT(delta, '-block_1') WHERE module = 'views'");
 }
 
-// NOTE: Update 6002 removed because it did not always work.
-// Update 6004 implements the change correctly.
+/*
+ * NOTE: Update 6002 removed because it did not always work.
+ * Update 6004 implements the change correctly.
+ */
 
 /**
  * Add missing unique key.
@@ -487,7 +488,7 @@ function views_update_6011() {
  */
 function views_update_6012() {
   // There is only one simple query to run.
-  $update = db_update('blocks')
+  db_update('blocks')
     ->condition('module', 'views')
     ->condition('delta', db_like('-exp-') . '%', 'LIKE')
     ->fields(array('cache' => DRUPAL_NO_CACHE));

Fichier diff supprimé car celui-ci est trop grand
+ 26 - 0
sites/all/modules/views/views.module


+ 0 - 1
sites/all/modules/views/views.tokens.inc

@@ -48,7 +48,6 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
     $url_options['language'] = $options['language'];
   }
   $sanitize = !empty($options['sanitize']);
-  $langcode = isset($options['language']) ? $options['language']->language : NULL;
 
   $replacements = array();
 

+ 4 - 3
sites/all/modules/views/views_ui.info

@@ -4,12 +4,13 @@ package = Views
 core = 7.x
 configure = admin/structure/views
 dependencies[] = views
+# @codingStandardsIgnoreLine
 files[] = views_ui.module
 files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php
 
-; Information added by Drupal.org packaging script on 2017-04-02
-version = "7.x-3.16"
+; Information added by Drupal.org packaging script on 2017-08-23
+version = "7.x-3.18"
 core = "7.x"
 project = "views"
-datestamp = "1491158591"
+datestamp = "1503495103"
 

+ 118 - 48
sites/all/modules/views/views_ui.module

@@ -6,6 +6,29 @@
  */
 
 /**
+ * Implements hook_help().
+ */
+function views_ui_help($path, $arg) {
+  switch ($path) {
+    case 'admin/help#views_ui':
+      $output = '';
+      $output .= '<h3>' . t('About') . '</h3>';
+      $output .= '<p>' . t('The Views UI module provides an interface for managing views for the Views module. For more information, see the <a href="@views" target="blank">online documentation for the Views UI module</a>.', array('@views' => 'https://www.drupal.org/documentation/modules/views')) . '</p>';
+      $output .= '<h3>' . t('Uses') . '</h3>';
+      $output .= '<dl>';
+      $output .= '<dt>' . t('Creating and managing views') . '</dt>';
+      $output .= '<dd>' . t('Views can be created from the <a href="/admin/structure/views">Views list page</a> by using the "Add view" action. Existing views can be managed from the <a href="/admin/structure/views">Views list page</a> by locating the view in the "Enabled" or "Disabled" list and selecting the desired operation action, for example "Edit".') . '</dd>';
+
+      $output .= '<dt>' . t('Enabling and disabling views') . '</dt>';
+      $output .= '<dd>' . t('Views can be enabled or disabled from the <a href="/admin/structure/views">Views list page</a>. To enable a view, find the view within the "Disabled" list and select the "Enable" operation. To disable a view find the view within the "Enabled" list and select the "Disable" operation.') . '</dd>';
+
+      $output .= '<dt>' . t('Exporting and importing views') . '</dt>';
+      $output .= '<dd>' . t('Views can be exported and imported as configuration files by using the Configuration Manager module.') . '</dd>';
+      return $output;
+  }
+}
+
+/**
  * Implements hook_menu().
  */
 function views_ui_menu() {
@@ -96,7 +119,6 @@ function views_ui_menu() {
   ) + $base;
 
   // Additional pages for acting on a View.
-
   $items['admin/structure/views/view/%views_ui_cache/break-lock'] = array(
     'title' => 'Break lock',
     'page callback' => 'drupal_get_form',
@@ -143,7 +165,7 @@ function views_ui_menu() {
     'type' => MENU_CALLBACK,
   ) + $base;
 
-  // A page in the Reports section to show usage of fields in all views
+  // A page in the Reports section to show usage of fields in all views.
   $items['admin/reports/fields/list'] = array(
     'title' => 'List',
     'type' => MENU_DEFAULT_LOCAL_TASK,
@@ -175,9 +197,17 @@ function views_ui_theme() {
   require_once DRUPAL_ROOT . "/$path/includes/admin.inc";
 
   return array(
-    // edit a view
+    // Edit a view.
     'views_ui_display_tab_setting' => array(
-      'variables' => array('description' => '', 'link' => '', 'settings_links' => array(), 'overridden' => FALSE, 'defaulted' => FALSE, 'description_separator' => TRUE, 'class' => array()),
+      'variables' => array(
+        'description' => '',
+        'link' => '',
+        'settings_links' => array(),
+        'overridden' => FALSE,
+        'defaulted' => FALSE,
+        'description_separator' => TRUE,
+        'class' => array(),
+      ),
       'template' => 'views-ui-display-tab-setting',
       'path' => "$path/theme",
     ),
@@ -198,7 +228,7 @@ function views_ui_theme() {
       'file' => 'includes/admin.inc',
     ),
 
-    // list views
+    // List views.
     'views_ui_view_info' => array(
       'variables' => array('view' => NULL, 'base' => NULL),
       'file' => "includes/admin.inc",
@@ -210,7 +240,7 @@ function views_ui_theme() {
       'file' => 'includes/admin.inc',
     ),
 
-    // tab themes
+    // Tab themes.
     'views_tabset' => array(
       'variables' => array('tabs' => NULL),
     ),
@@ -222,15 +252,19 @@ function views_ui_theme() {
       'file' => 'includes/admin.inc',
     ),
 
-
-    // On behalf of a plugin
+    // On behalf of a plugin.
     'views_ui_style_plugin_table' => array(
       'render element' => 'form',
     ),
 
     // When previewing a view.
     'views_ui_view_preview_section' => array(
-      'variables' => array('view' => NULL, 'section' => NULL, 'content' => NULL, 'links' => ''),
+      'variables' => array(
+        'view' => NULL,
+        'section' => NULL,
+        'content' => NULL,
+        'links' => '',
+      ),
     ),
 
     // Generic container wrapper, to use instead of theme_container when an id
@@ -274,10 +308,10 @@ function views_ui_edit_page_title($view) {
 /**
  * Specialized menu callback to load a view and check its locked status.
  *
- * @param $name
+ * @param string $name
  *   The machine name of the view.
  *
- * @return
+ * @return object
  *   The view object, with a "locked" property indicating whether or not
  *   someone else is already editing the view.
  */
@@ -315,6 +349,8 @@ function views_ui_cache_load($name) {
 }
 
 /**
+ * Cache set.
+ *
  * Specialized cache function to add a flag to our view, include an appropriate
  * include, and cache more easily.
  */
@@ -324,7 +360,8 @@ function views_ui_cache_set(&$view) {
     return;
   }
   ctools_include('object-cache');
-  $view->changed = TRUE; // let any future object know that this view has changed.
+  // Let any future object know that this view has changed.
+  $view->changed = TRUE;
 
   if (isset($view->current_display)) {
     // Add the knowledge of the changed display, too.
@@ -332,7 +369,7 @@ function views_ui_cache_set(&$view) {
     unset($view->current_display);
   }
 
-  // Unset handlers; we don't want to write these into the cache
+  // Unset handlers; we don't want to write these into the cache.
   unset($view->display_handler);
   unset($view->default_display);
   $view->query = NULL;
@@ -343,8 +380,9 @@ function views_ui_cache_set(&$view) {
   ctools_object_cache_set('view', $view->name, $view);
 }
 
-
 /**
+ * Default Load.
+ *
  * Specialized menu callback to load a view that is only a default
  * view.
  */
@@ -364,7 +402,21 @@ function views_ui_preprocess_views_view(&$vars) {
   $view = $vars['view'];
   if (!empty($view->views_ui_context) && module_exists('contextual')) {
     $view->hide_admin_links = TRUE;
-    foreach (array('title', 'header', 'exposed', 'rows', 'pager', 'more', 'footer', 'empty', 'attachment_after', 'attachment_before') as $section) {
+
+    $sections = array(
+      'title',
+      'header',
+      'exposed',
+      'rows',
+      'pager',
+      'more',
+      'footer',
+      'empty',
+      'attachment_after',
+      'attachment_before',
+    );
+
+    foreach ($sections as $section) {
       if (!empty($vars[$section])) {
         $vars[$section] = array(
           '#theme' => 'views_ui_view_preview_section',
@@ -392,40 +444,49 @@ function template_preprocess_views_ui_view_preview_section(&$vars) {
       $vars['title'] = t('Title');
       $links = views_ui_view_preview_section_display_category_links($vars['view'], 'title', $vars['title']);
       break;
+
     case 'header':
       $vars['title'] = t('Header');
       $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
       break;
+
     case 'empty':
       $vars['title'] = t('No results behavior');
       $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
       break;
+
     case 'exposed':
       // @todo Sorts can be exposed too, so we may need a better title.
       $vars['title'] = t('Exposed Filters');
       $links = views_ui_view_preview_section_display_category_links($vars['view'], 'exposed_form_options', $vars['title']);
       break;
+
     case 'rows':
       // @todo The title needs to depend on what is being viewed.
       $vars['title'] = t('Content');
       $links = views_ui_view_preview_section_rows_links($vars['view']);
       break;
+
     case 'pager':
       $vars['title'] = t('Pager');
       $links = views_ui_view_preview_section_display_category_links($vars['view'], 'pager_options', $vars['title']);
       break;
+
     case 'more':
       $vars['title'] = t('More');
       $links = views_ui_view_preview_section_display_category_links($vars['view'], 'use_more', $vars['title']);
       break;
+
     case 'footer':
       $vars['title'] = t('Footer');
       $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
       break;
+
     case 'attachment_before':
       // @todo: Add links to the attachment configuration page.
       $vars['title'] = t('Attachment before');
       break;
+
     case 'attachment_after':
       // @todo: Add links to the attachment configuration page.
       $vars['title'] = t('Attachment after');
@@ -454,18 +515,18 @@ function template_preprocess_views_ui_view_preview_section(&$vars) {
 function theme_views_ui_view_preview_section($vars) {
   return '<h1 class="section-title">' . $vars['title'] . '</h1>'
   . $vars['links']
-  . '<div class="preview-section">'. $vars['content'] . '</div>';
+  . '<div class="preview-section">' . $vars['content'] . '</div>';
 }
 
 /**
  * Returns contextual links for each handler of a certain section.
  *
+ * @param string $title
+ *   Add a bolded title of this section.
+ *
  * @TODO
  *   Bring in relationships
  *   Refactor this function to use much stuff of views_ui_edit_form_get_bucket.
- *
- * @param $title
- *   Add a bolded title of this section.
  */
 function views_ui_view_preview_section_handler_links($view, $type, $title = FALSE) {
   $display = $view->display_handler->display;
@@ -516,8 +577,9 @@ function views_ui_view_preview_section_display_category_links($view, $type, $tit
  * Returns all contextual links for the main content part of the view.
  */
 function views_ui_view_preview_section_rows_links($view) {
-  $display = $view->display_handler->display;
+
   $links = array();
+
   $links = array_merge($links, views_ui_view_preview_section_handler_links($view, 'filter', TRUE));
   $links = array_merge($links, views_ui_view_preview_section_handler_links($view, 'field', TRUE));
   $links = array_merge($links, views_ui_view_preview_section_handler_links($view, 'sort', TRUE));
@@ -527,7 +589,6 @@ function views_ui_view_preview_section_rows_links($view) {
   return $links;
 }
 
-
 /**
  * Implments hook_ctools_plugin_directory().
  *
@@ -542,10 +603,10 @@ function views_ui_ctools_plugin_directory($module, $plugin) {
 /**
  * Fetch metadata on a specific views ui wizard plugin.
  *
- * @param $wizard_type
+ * @param string $wizard_type
  *   Name of a wizard, or name of a base table.
  *
- * @return
+ * @return array
  *   An array with information about the requested wizard type.
  */
 function views_ui_get_wizard($wizard_type) {
@@ -571,14 +632,14 @@ function views_ui_get_wizard($wizard_type) {
 /**
  * Fetch metadata for all content_type plugins.
  *
- * @return
+ * @return array
  *   An array of arrays with information about all available views wizards.
  */
 function views_ui_get_wizards() {
   ctools_include('plugins');
   $wizard_plugins = ctools_get_plugins('views_ui', 'views_wizard');
   $wizard_tables = array();
-  foreach ($wizard_plugins as $name => $info) {
+  foreach ($wizard_plugins as $info) {
     $wizard_tables[$info['base_table']] = TRUE;
   }
   $base_tables = views_fetch_base_tables();
@@ -599,7 +660,7 @@ function views_ui_get_wizards() {
 /**
  * Helper function to define the default values for a Views wizard plugin.
  *
- * @return
+ * @return array
  *   An array of defaults for a views wizard.
  */
 function views_ui_views_wizard_defaults() {
@@ -607,7 +668,7 @@ function views_ui_views_wizard_defaults() {
     // The children may, for example, be a different variant for each node type.
     'get children' => NULL,
     'get child' => NULL,
-    // title and base table must be populated.  They are empty here just
+    // Title and base table must be populated.  They are empty here just
     // so they are documented.
     'title' => '',
     'base_table' => NULL,
@@ -636,6 +697,9 @@ function views_ui_ctools_plugin_type() {
   );
 }
 
+/**
+ * Get form wizard instance.
+ */
 function views_ui_get_form_wizard_instance($wizard) {
   if (isset($wizard['form_wizard_class']['class'])) {
     $class = $wizard['form_wizard_class']['class'];
@@ -705,7 +769,7 @@ function views_ui_contextual_links_suppress($set = NULL) {
  * @see views_ui_contextual_links_suppress_pop()
  */
 function views_ui_contextual_links_suppress_push() {
-  views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress())+1);
+  views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress()) + 1);
 }
 
 /**
@@ -714,13 +778,16 @@ function views_ui_contextual_links_suppress_push() {
  * @see views_ui_contextual_links_suppress_push()
  */
 function views_ui_contextual_links_suppress_pop() {
-  views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress())-1);
+  views_ui_contextual_links_suppress(((int) views_ui_contextual_links_suppress()) - 1);
 }
 
 /**
- * Menu callback; handles AJAX form submissions similar to ajax_form_callback(), but can be used for uncached forms.
+ * Menu callback.
  *
- * ajax_form_callback(), the menu callback for the system/ajax path, requires
+ * Handles AJAX form submissions similar to ajax_form_callback(), but can be
+ * used for uncached forms.
+ *
+ * Ajax_form_callback(), the menu callback for the system/ajax path, requires
  * the form to be retrievable from the form cache, because it lacks a trusted
  * $form_id argument with which to call drupal_retrieve_form(). When AJAX is
  * wanted on a non-cacheable form, #ajax['path'] can be set to a path whose
@@ -760,16 +827,18 @@ function views_ui_ajax_get_form($form_id) {
     return $callback($form, $form_state);
   }
 }
-// @todo move these when we can
 
+/**
+ * @todo move these when we can
+ */
 
 /**
  * Helper function to get a list of paths assigned to a view.
  *
- * @param $view
+ * @param object $view
  *   The view.
  *
- * @return
+ * @return array
  *   An array of links to this view's display paths.
  */
 function _views_ui_get_paths($view) {
@@ -778,14 +847,14 @@ function _views_ui_get_paths($view) {
     $all_paths[] = t('Edit this view to add a display.');
   }
   else {
-    $view->init_display();   // Make sure all the handlers are set up
+    // Make sure all the handlers are set up.
+    $view->init_display();
     foreach ($view->display as $display) {
       if (!empty($display->handler) && $display->handler->has_path()) {
         $one_path = $display->handler->get_option('path');
-        if (empty($path_sort)) {
-          $path_sort = strtolower($one_path);
-        }
+
         if (empty($view->disabled) && strpos($one_path, '%') === FALSE) {
+          // @codingStandardsIgnoreLine
           $all_paths[] = l('/' . $one_path, $one_path);
         }
         else {
@@ -801,10 +870,10 @@ function _views_ui_get_paths($view) {
 /**
  * Helper function to get a list of displays included in a view.
  *
- * @param $view
+ * @param object $view
  *   The view.
  *
- * @return
+ * @return array
  *   An array of display types that this view includes.
  */
 function _views_ui_get_displays_list($view) {
@@ -823,21 +892,22 @@ function _views_ui_get_displays_list($view) {
 }
 
 /**
- * This is part of a patch to address a jQueryUI bug.  The bug is responsible
- * for the inability to scroll a page when a modal dialog is active. If the content
- * of the dialog extends beyond the bottom of the viewport, the user is only able
- * to scroll with a mousewheel or up/down keyboard keys.
+ * This is part of a patch to address a jQueryUI bug.
+ *
+ * The bug is responsible
+ * for the inability to scroll a page when a modal dialog is active. If the
+ * content of the dialog extends beyond the bottom of the viewport, the user is
+ * only able to scroll with a mousewheel or up/down keyboard keys.
  *
  * @see http://bugs.jqueryui.com/ticket/4671
  * @see https://bugs.webkit.org/show_bug.cgi?id=19033
  * @see /js/jquery.ui.dialog.patch.js
  * @see /js/jquery.ui.dialog.min.js
  *
- * The javascript patch overwrites the $.ui.dialog.overlay.events object to remove
- * the mousedown, mouseup and click events from the list of events that are bound
- * in $.ui.dialog.overlay.create.
+ * The javascript patch overwrites the $.ui.dialog.overlay.events object to
+ * remove the mousedown, mouseup and click events from the list of events that
+ * are bound in $.ui.dialog.overlay.create.
  */
-
 function views_ui_library_alter(&$libraries, $module) {
   if ($module == 'system' && isset($libraries['ui.dialog'])) {
     // Only apply the fix, if we don't have an up to date jQueryUI version.