File.php

Same filename in this branch
  1. 8.9.x core/modules/media/src/Plugin/media/Source/File.php
  2. 8.9.x core/modules/file/src/Entity/File.php
  3. 8.9.x core/modules/file/src/Plugin/views/field/File.php
  4. 8.9.x core/modules/file/src/Plugin/migrate/source/d6/File.php
  5. 8.9.x core/modules/file/src/Plugin/migrate/source/d7/File.php
  6. 8.9.x core/lib/Drupal/Core/Render/Element/File.php
Same filename in other branches
  1. 9 core/modules/media/src/Plugin/media/Source/File.php
  2. 9 core/modules/file/src/Entity/File.php
  3. 9 core/modules/file/src/Plugin/views/field/File.php
  4. 9 core/modules/file/src/Plugin/views/wizard/File.php
  5. 9 core/modules/file/src/Plugin/migrate/source/d6/File.php
  6. 9 core/modules/file/src/Plugin/migrate/source/d7/File.php
  7. 9 core/lib/Drupal/Core/Render/Element/File.php
  8. 10 core/modules/media/src/Plugin/media/Source/File.php
  9. 10 core/modules/file/src/Entity/File.php
  10. 10 core/modules/file/src/Plugin/views/field/File.php
  11. 10 core/modules/file/src/Plugin/views/wizard/File.php
  12. 10 core/modules/file/src/Plugin/migrate/source/d6/File.php
  13. 10 core/modules/file/src/Plugin/migrate/source/d7/File.php
  14. 10 core/lib/Drupal/Core/Render/Element/File.php
  15. 11.x core/modules/media/src/Plugin/media/Source/File.php
  16. 11.x core/modules/file/src/Entity/File.php
  17. 11.x core/modules/file/src/Plugin/views/field/File.php
  18. 11.x core/modules/file/src/Plugin/views/wizard/File.php
  19. 11.x core/modules/file/src/Plugin/migrate/source/d6/File.php
  20. 11.x core/modules/file/src/Plugin/migrate/source/d7/File.php
  21. 11.x core/lib/Drupal/Core/Render/Element/File.php

Namespace

Drupal\file\Plugin\views\wizard

File

core/modules/file/src/Plugin/views/wizard/File.php

View source
<?php

namespace Drupal\file\Plugin\views\wizard;

use Drupal\views\Plugin\views\wizard\WizardPluginBase;

/**
 * Tests creating managed files views with the wizard.
 *
 * @ViewsWizard(
 *   id = "file_managed",
 *   base_table = "file_managed",
 *   title = @Translation("Files")
 * )
 */
class File extends WizardPluginBase {
    
    /**
     * Set the created column.
     *
     * @var string
     */
    protected $createdColumn = 'created';
    
    /**
     * {@inheritdoc}
     */
    protected function defaultDisplayOptions() {
        $display_options = parent::defaultDisplayOptions();
        // Add permission-based access control.
        $display_options['access']['type'] = 'perm';
        // Remove the default fields, since we are customizing them here.
        unset($display_options['fields']);
        
        /* Field: File: Name */
        $display_options['fields']['filename']['id'] = 'filename';
        $display_options['fields']['filename']['table'] = 'file_managed';
        $display_options['fields']['filename']['field'] = 'filename';
        $display_options['fields']['filename']['entity_type'] = 'file';
        $display_options['fields']['filename']['entity_field'] = 'filename';
        $display_options['fields']['filename']['label'] = '';
        $display_options['fields']['filename']['alter']['alter_text'] = 0;
        $display_options['fields']['filename']['alter']['make_link'] = 0;
        $display_options['fields']['filename']['alter']['absolute'] = 0;
        $display_options['fields']['filename']['alter']['trim'] = 0;
        $display_options['fields']['filename']['alter']['word_boundary'] = 0;
        $display_options['fields']['filename']['alter']['ellipsis'] = 0;
        $display_options['fields']['filename']['alter']['strip_tags'] = 0;
        $display_options['fields']['filename']['alter']['html'] = 0;
        $display_options['fields']['filename']['hide_empty'] = 0;
        $display_options['fields']['filename']['empty_zero'] = 0;
        $display_options['fields']['filename']['plugin_id'] = 'field';
        $display_options['fields']['filename']['type'] = 'file_link';
        return $display_options;
    }

}

Classes

Title Deprecated Summary
File Tests creating managed files views with the wizard.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.