You are here

function filebrowser_theme_suggestions_container_alter in Filebrowser 3.x

Same name and namespace in other branches
  1. 8.2 filebrowser.module \filebrowser_theme_suggestions_container_alter()

Implements hook_theme_suggestions_HOOK_alter(). @inheritdoc

File

./filebrowser.module, line 321

Code

function filebrowser_theme_suggestions_container_alter(array &$suggestions, array $variables) {
  if ($node = \Drupal::service('filebrowser.common')
    ->getNodeFromPath()) {
    if ($node
      ->bundle() == 'dir_listing') {
      if (!empty($variables['element']['#attributes']['class'])) {
        $classes = $variables['element']['#attributes']['class'];
        if (in_array(Common::FILEBROWSER_GRID_CONTAINER_CLASS, $classes)) {
          $suggestions = [
            'filebrowser_container',
          ];
        }
        if (in_array(Common::FILEBROWSER_GRID_CONTAINER_COLUMN_CLASS, $classes)) {
          $suggestions = [
            'filebrowser_container_column',
          ];
        }
      }
    }
  }
}