You are here

function gc_preprocess_views_view_table in GatherContent 8

Implements template_preprocess_views_view_table().

File

./_old.gc.module, line 846

Code

function gc_preprocess_views_view_table(&$variables) {
  $view = $variables['view'];
  switch ("{$view->name}:{$view->current_display}:{$view->plugin_name}") {
    case 'update:page:table':
    case 'update:page_1:table':

      // Libraries module and tablesorter plugin are optional.
      // If tablesorter available, add it to the scope.
      if (\Drupal::moduleHandler()
        ->moduleExists('libraries')) {
        $library = libraries_detect('tablesorter-mottie');
        if ($library['installed']) {
          $gc_module_path = drupal_get_path('module', 'gc');
          $variables['classes_array'][] = 'tablesorter-enabled';

          // @FIXME
          // The Assets API has totally changed. CSS, JavaScript, and libraries are now
          // attached directly to render arrays using the #attached property.
          //
          //
          // @see https://www.drupal.org/node/2169605
          // @see https://www.drupal.org/node/2408597
          // drupal_add_js($gc_module_path . '/js/gc-tablesorter.js');
          // @FIXME
          // The Assets API has totally changed. CSS, JavaScript, and libraries are now
          // attached directly to render arrays using the #attached property.
          //
          //
          // @see https://www.drupal.org/node/2169605
          // @see https://www.drupal.org/node/2408597
          // drupal_add_js(array(
          //             'gc' => array(
          //               'tablesorterOptionOverrides' => array(
          //                 'headers' => array(
          //                   '0' => array(
          //                     'sorter' => FALSE,
          //                   ),
          //                   '9' => array(
          //                     'sorter' => FALSE,
          //                   ),
          //                   '10' => array(
          //                     'sorter' => FALSE,
          //                   ),
          //                 ),
          //               ),
          //             ),
          //           ), 'setting');
          libraries_load('tablesorter-mottie');
        }
      }
      break;
    case 'import_result_page:page:table':
    case 'import_result_page:page_1:table':
    case 'import_result_page:page_2:table':

      // Libraries module and tablesorter plugin are optional.
      // If tablesorter available, add it to the scope.
      if (\Drupal::moduleHandler()
        ->moduleExists('libraries')) {
        $library = libraries_detect('tablesorter-mottie');
        if ($library['installed']) {
          $gc_module_path = drupal_get_path('module', 'gc');
          $variables['classes_array'][] = 'tablesorter-enabled';

          // @FIXME
          // The Assets API has totally changed. CSS, JavaScript, and libraries are now
          // attached directly to render arrays using the #attached property.
          //
          //
          // @see https://www.drupal.org/node/2169605
          // @see https://www.drupal.org/node/2408597
          // drupal_add_js($gc_module_path . '/js/gc-tablesorter.js');
          // @FIXME
          // The Assets API has totally changed. CSS, JavaScript, and libraries are now
          // attached directly to render arrays using the #attached property.
          //
          //
          // @see https://www.drupal.org/node/2169605
          // @see https://www.drupal.org/node/2408597
          // drupal_add_js(array(
          //             'gc' => array(
          //               'tablesorterOptionOverrides' => array(
          //                 'headers' => array(
          //                   '4' => array(
          //                     'sorter' => FALSE,
          //                   ),
          //                   '5' => array(
          //                     'sorter' => FALSE,
          //                   ),
          //                 ),
          //               ),
          //             ),
          //           ), 'setting');
          libraries_load('tablesorter-mottie');
        }
      }
      break;
  }
}