You are here

function opigno_module_preprocess_views_view_field in Opigno module 8

Same name and namespace in other branches
  1. 3.x opigno_module.module \opigno_module_preprocess_views_view_field()

Implements hook_views_view_field().

File

./opigno_module.module, line 1160
Contains opigno_module.module.

Code

function opigno_module_preprocess_views_view_field(&$variables) {
  if ($variables['view']
    ->id() == 'media_browser_file_pdf' && $variables['field']->options['id'] == 'name') {
    $variables['bundle'] = $variables['view']->field['bundle']->original_value
      ->jsonSerialize();
  }
  if ($variables['view']
    ->id() == 'module_list' && $variables['field']->options['id'] == 'name') {
    $output = $variables['output']
      ->jsonSerialize();
    if (strpos($output, $_SERVER["HTTP_HOST"] . '//') !== FALSE) {
      $output = str_replace($_SERVER["HTTP_HOST"] . '//', $_SERVER["HTTP_HOST"] . '/', $output);
      $variables['output'] = [
        '#markup' => $output,
      ];
    }
  }
}