You are here

function opigno_module_preprocess_views_view_field in Opigno module 3.x

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

Implements hook_views_view_field().

File

./opigno_module.module, line 1159
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,
      ];
    }
  }
}