You are here

function filebrowser_node_view in Filebrowser 8

Same name and namespace in other branches
  1. 8.2 filebrowser.module \filebrowser_node_view()
  2. 7.4 filebrowser.module \filebrowser_node_view()
  3. 7.2 filebrowser.module \filebrowser_node_view()
  4. 7.3 filebrowser.module \filebrowser_node_view()
  5. 3.x filebrowser.module \filebrowser_node_view()

Implements hook_view().

File

./filebrowser.module, line 294
Validates file path input on node form

Code

function filebrowser_node_view(Node $node, EntityViewDisplayInterface $display, $view_mode, $langcode) {

  // if ($view_mode=="full") {
  //  _filebrowser_load_files($node);
  // Full node content view
  // ========================================================
  // Keep track of the current location and update breadcrumbs to reflect that.
  // todo: Set breadcrumbs D8 style: https://drupal.org/node/2026025
  // check D7 version
  // Insert file listing  content part
  //  if ($display->getComponent('mymodule_addition')) {
  $node->content['mymodule_addition'] = array(
    // '#markup' => mymodule_addition($node),
    // '#theme' => 'mymodule_my_additional_field',
    '#markup' => "<p><strong>Markup</strong></p>",
  );

  //   }

  /*
      $current_view = _filebrowser_externals('presentations', $node->folder_presentation->default_view);
      $node->content['filebrowser_content'] = array(
   '#markup' => count($node->file_listing) == 0 ? '' : theme($current_view['theme'], array('node' => $node)),
   '#weight' => 1
      );
      if ($node->folder_uploads->enabled && user_access(FILEBROWSER_UPLOAD)) {
   $node->content['filebrowser_form_upload'] = array(
     '#markup' => drupal_render(drupal_get_form('filebrowser_form_upload', $node)),
     '#weight' => 2
   );
      }
      if ($node->folder_uploads->enabled && user_access(FILEBROWSER_CREATE_FOLDER)) {
   $node->content['filebrowser_form_create_folder'] = array(
     '#markup' => drupal_render(drupal_get_form('filebrowser_form_create_folder', $node)),
     '#weight' => 3
   );
      }
      $statistics = array(
   'empty' => t('This folder is empty')
      );
      if ($node->file_listing['.']['folders_count'] > 0) {
   $statistics['folders'] = format_plural($node->file_listing['.']['folders_count'], '1 dossier', '@count dossiers');
   $statistics['empty'] = NULL;
      }
      if ($node->file_listing['.']['files_count'] > 0) {
   $statistics['files'] = format_plural($node->file_listing['.']['files_count'], '1 file', '@count files');
   $statistics['size'] = format_size($node->file_listing['.']['size']);
   $statistics['empty'] = NULL;
      }
      $node->content['filebrowser_statistics'] = array(
   '#markup' => theme('dir_listing_statistics', $statistics),
   '#weight' => 3
      );
    }
    // Insert filebrowser links
    $node-> content['links']['filebrowser'] = array('#theme' => 'links__node__blog',
      '#links' => _filebrowser_links($node),
      '#attributes' => array('class' => array('links', 'inline')),);
      /*
  *
  */

  // }
  return $node;
}